K
Karen
I am reposting this because I'm afraid it's too old to be found and
answered.
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.
If I change the MyCriteria line to MyCriteria = Me!Custno & "'"
and I change the MySql line to
MySQL = "SELECT * FROM dbo_oeprcfil_sql WHERE dbo_oeprcfil_sql.[filler_0001]
= '"
I get an error 'Type Mismatch'
The value I'm entering in the control on the form is 0000000021923920-M
----------------
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 = ")
------------------
Help!!!
Thank you (yet again!)
Karen
answered.
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.
If I change the MyCriteria line to MyCriteria = Me!Custno & "'"
and I change the MySql line to
MySQL = "SELECT * FROM dbo_oeprcfil_sql WHERE dbo_oeprcfil_sql.[filler_0001]
= '"
I get an error 'Type Mismatch'
The value I'm entering in the control on the form is 0000000021923920-M
----------------
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 = ")
------------------
Help!!!
Thank you (yet again!)
Karen