B
Brian
I am trying to use the recordset.Open command to run an
SQL statement. The book a I am reading has this for an
example:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenStatic
rst.Open "Select * from tblClients"
rst.Close
Set rst = Nothing
I have no problem getting that to work, but i have an SQL
statement saved as a string and i want to pass that
through the rst.Open command. I tried:
rst.Open strsearch
strsearch is the varible with my search string in it.
The string changes depending on what the user is
searching for, so i cant just type in an SQL statement
like in the example. But when i put the varible name in
there i get an error:
Run-time error '3001'
Arguments are of the wrong type, are out of
acceptable range, or are in conflict with
one another.
I'm not sure what that means in English. I hit debug and
it highlights the 'rst.Open strsearch' line.
Any help would be great. Thanks!
Brian
SQL statement. The book a I am reading has this for an
example:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenStatic
rst.Open "Select * from tblClients"
rst.Close
Set rst = Nothing
I have no problem getting that to work, but i have an SQL
statement saved as a string and i want to pass that
through the rst.Open command. I tried:
rst.Open strsearch
strsearch is the varible with my search string in it.
The string changes depending on what the user is
searching for, so i cant just type in an SQL statement
like in the example. But when i put the varible name in
there i get an error:
Run-time error '3001'
Arguments are of the wrong type, are out of
acceptable range, or are in conflict with
one another.
I'm not sure what that means in English. I hit debug and
it highlights the 'rst.Open strsearch' line.
Any help would be great. Thanks!
Brian