Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset syntax Error 3061 2

Status
Not open for further replies.

Gfunk13

Programmer
Feb 28, 2004
17
US
I am getting a Run-Time error 3061 (Too few parameters. Expected 1) on this:

Set rst1 = dbs.OpenRecordset("SELECT Lot_Num, Origin AS Expr1 , Matrl_Class AS Expr2
FROM [Raw_Matrl_Receipt_Table]
WHERE (([Lot_Num] = Me![LOT #])))

I have tried modifying the WHERE clause in every way I can think of and still not having any luck.
 
How about:

[tt]Set rst1 = dbs.OpenRecordset("SELECT Lot_Num, Origin AS Expr1 , Matrl_Class AS Expr2
FROM [Raw_Matrl_Receipt_Table]
WHERE [Lot_Num] =" & Me![LOT #][/tt]

That is assuming that [Lot_Num] is a number field.


 
Set rst1 = dbs.OpenRecordset("SELECT Lot_Num,Origin, Matrl_Class FROM Raw_Matrl_Receipt_Table WHERE Lot_Num='" & Me![LOT #] & "'")

If Lot_Num is defined as numeric in Raw_Matrl_Receipt_Table then get rid of the single quotes.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks Remou and PHV.

Lot_Num is a Text field (Num is misleading:))

I tried both and now I am getting run-time 3464 (data mismatch in criteria expression.

I removed the single quotes in the PHV suggestion, but still received the error.

This was my most recent attempt (without success):

Set rst1 = dbs.OpenRecordset("SELECT Lot_Num,Origin AS Expr1, Matrl_Class AS Expr2 FROM Raw_Matrl_Receipt_Table WHERE Lot_Num=" & Me![LOT #] & "")

Me!Origin = rst1("Expr1")
Me!Material = rst1("Expr2")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top