K
Karen
I have the following code that I'm trying to use to 'view' one record of a
SQL table that I've linked to with Access 2002. This code is behind a
button on a form. On the form I enter a value in a control named custno.
When I click the button I get an error that says 'Too few parameters.
Expected 1." In the SQL table, filler_0001 is a text field.
----------------
Dim rst As Recordset
Dim MyWksp As Workspace
Dim MyDB As Database
Dim MySQL As String, MyCriteria As String
Set MyWksp = DBEngine.Workspaces(0)
Set MyDB = MyWksp.Databases(0)
MySQL = "SELECT * FROM dbo_oeprcfil_sql WHERE
dbo_oeprcfil_sql.[filler_0001] ="
MyCriteria = Me!Custno
Set rst = MyDB.OpenRecordset(MySQL & MyCriteria, dbOpenForwardOnly)
If Not rst.EOF Then
MsgBox ("CustomerNumber/Code = ")
------------------
If I change the MyCriteria line to (and add a single quote after the last
equal sign in the MySql statement)
MyCriteria = Me!Custno & "'"
I get an error 'Type Mismatch'
The value I'm entering in the control on the form is 0000000021923920-M
Help!!!
Thank you (yet again!)
Karen
SQL table that I've linked to with Access 2002. This code is behind a
button on a form. On the form I enter a value in a control named custno.
When I click the button I get an error that says 'Too few parameters.
Expected 1." In the SQL table, filler_0001 is a text field.
----------------
Dim rst As Recordset
Dim MyWksp As Workspace
Dim MyDB As Database
Dim MySQL As String, MyCriteria As String
Set MyWksp = DBEngine.Workspaces(0)
Set MyDB = MyWksp.Databases(0)
MySQL = "SELECT * FROM dbo_oeprcfil_sql WHERE
dbo_oeprcfil_sql.[filler_0001] ="
MyCriteria = Me!Custno
Set rst = MyDB.OpenRecordset(MySQL & MyCriteria, dbOpenForwardOnly)
If Not rst.EOF Then
MsgBox ("CustomerNumber/Code = ")
------------------
If I change the MyCriteria line to (and add a single quote after the last
equal sign in the MySql statement)
MyCriteria = Me!Custno & "'"
I get an error 'Type Mismatch'
The value I'm entering in the control on the form is 0000000021923920-M
Help!!!
Thank you (yet again!)
Karen