Run-time Error 3061: Too few parameters

frispee

Registered User.
Local time
Today, 13:59
Joined
May 23, 2012
Messages
28
Hi,

I am trying to run a query from within VBA and I am coming up with this error. Please help!

Code:
Set TACData = CurrentDb.OpenRecordset("SELECT * FROM TACWithLRB_tbl WHERE [Part Number] is not null AND [Supplier Name] = Me.SupplierName_cbx.Value AND [Destination Plant] = Me.PlantName_cbx.Value ORDER BY TACWithLRB_tbl.[Part Number];")

TACData is defined as a DAO.Recordset. Plantname_cbx and SupplierName_cbx are both combo boxes containing text values. Thanks in advance :)
 
Thanks for the quick reply. However, when I changed the code as per the other person's code, I get syntax error:

Code:
Set TACData = CurrentDb.OpenRecordset("SELECT * FROM TACWithLRB_tbl WHERE [Part Number] is not null AND [Supplier Name] = '"&Me.SupplierName_cbx&"' AND [Destination Plant] = '"&Me.PlantName_cbx&"' ORDER BY TACWithLRB_tbl.[Part Number];")

Can you tell me what I am doing wrong? Thanks :)
 
Are there spaces around all the &? What are the data types of your fields? From the other thread you can see a numeric data type wouldn't have the single quotes around it.
 

Users who are viewing this thread

Back
Top Bottom