B
Brian
Hello. My public variable is acting wierd.
Here is a copy of my code:
Sub Form_Load()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Debug.Print "LOAD " & strsearch
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
--> rst.Open strsearch, Options:=adCmdText
Set Me.Recordset = rst
End Sub
The line with the arrow is where is i get an error:
"No value given for one or more required parameters."
The variable strsearch is declared in Module1 as:
Public strsearch As String
strsearch just contains an SQL statement stored as a
string.
At the debug line in the code above, it prints out the
value in strsearch just fine. But when the code reaches
the rst.Open line, it errors out with the above error.
Why will debug.print see the variable and rst.open not
see it?
Thanks for any help on this.
Brian
Here is a copy of my code:
Sub Form_Load()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Debug.Print "LOAD " & strsearch
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
--> rst.Open strsearch, Options:=adCmdText
Set Me.Recordset = rst
End Sub
The line with the arrow is where is i get an error:
"No value given for one or more required parameters."
The variable strsearch is declared in Module1 as:
Public strsearch As String
strsearch just contains an SQL statement stored as a
string.
At the debug line in the code above, it prints out the
value in strsearch just fine. But when the code reaches
the rst.Open line, it errors out with the above error.
Why will debug.print see the variable and rst.open not
see it?
Thanks for any help on this.
Brian