Query error, too few parameters

Joined
Jan 14, 2010
Messages
1
Reaction score
0
Access 2003 VBA

My project includes a form with a combo box, text from the combo box is an input to a query. when I run the query in design view it prompts me for the parameter name and the results are correct, when I run it from the form using the input from the combo box I get error 3061, too few parameters. I added a watch for qdf and I do see that the parameter from the combo box is entered.
Please help

my VBA code

Code:
Dim qdf As DAO.QueryDef
    Set qdf = db.QueryDefs("qrySerialNumber")
    qdf.Parameters("ServerName2") = "'" & Forms![frmServers_1]![cmbServerName] & "'"
    
    Set rs = db.OpenRecordset("qrySerialNumber", dbOpenForwardOnly)
Query

Code:
SELECT dbo_TBL_ServerInformation.SerialNumber, dbo_TBL_ServerInformation.DiskSize, dbo_TBL_ServerInformation.WarrantyExpiration
FROM dbo_TBL_ServerInformation INNER JOIN dbo_TBL_Location ON dbo_TBL_ServerInformation.LocationID=dbo_TBL_Location.LocationID
WHERE (((dbo_TBL_ServerInformation.ServerName)=ServerName2));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top