So I am playing around with ADO connections, and got this bit of code from a book: Microsoft Access 2013 Bible
However, I get an error: Invalid SQL statement, on the adCmd.Execute.
The book claims it works.
What am I missing?
Thanks
Code:
Public Function ExecuteCommand()
Dim adRs As ADODB.Recordset
Dim adCmd As ADODB.Command
Const sTABLE As String = "Users"
Set adRs = New ADODB.Recordset
Set adCmd = New ADODB.Command
adCmd.ActiveConnection = CurrentProject.Connection
adCmd.CommandText = sTABLE
Set adRs = adCmd.Execute
Debug.Print adRs.GetString
adRs.Close
Set adRs = Nothing
Set adCmd = Nothing
End Function
However, I get an error: Invalid SQL statement, on the adCmd.Execute.
The book claims it works.
What am I missing?
Thanks