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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Too few parameters" in an OpenRecordSet

Status
Not open for further replies.

Sullaway

Technical User
Sep 27, 2000
50
0
0
US
Hello Tek-Tippers,

I'm having problems getting this error fixed. I have been reading books, past post, & etc. for about 3 hours now. I have found a lot of information on it but just can't seem to fix my problem.

I'm trying to pull infomation from Table Customers and update the Address fields in Guardian, if the CustomersID (number) matches. Below is the line of code that keeps puking.

strSQL = "SELECT [CustomersID],[Address] FROM Customers WHERE Customers.CustomersID=[Forms]![frmGuardian]![CustomersID]"
Set rst = dbs.OpenRecordset(strSQL)

It keeps telling me "Too few parameters. Expect 1". If I take the WHERE clause out the field will update but the info is from the first record so I know my problem is in the WHERE portion but no matter how many different syntax combinations that I've tried I can't see to get it to quit puking.

Any help would be greatly appreciated.
Shane
 

You need to allow the VBA code to interpret the contents of the control, [Forms]![frmGuardian]![CustomersID]. Move the control outside of the quotes.

strSQL = "SELECT [CustomersID],[Address] FROM Customers WHERE Customers.CustomersID=" & [Forms]![frmGuardian]![CustomersID] Terry Broadbent

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Terry,

Thanks for the help. It almost always turns out to be something simple.

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top