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

SQL Problem in Form 1

Status
Not open for further replies.

mdmarney

IS-IT--Management
Jan 16, 2003
68
US
The follwing SQL is giving error:

Set rs = CurrentDb.OpenRecordset("SELECT * FROM tbl_Attendants WHERE Parish_Group_ID = Me![Parish_Group_ID]")

Error: Too few parameters. Expected 1.

I can run the SQL statement alone and it works fine.
Any thoughts? *************
M. MARNEY
 
You need to take your variable out of the quotes, otherwise it gets interpreted literally.

("SELECT * FROM tbl_Attendants WHERE Parish_Group_ID = " & Me![Parish_Group_ID])
Maq [americanflag]
<insert witty signature here>
 
Thanks! Worked great. Do you know of any web sites with good SQL reference where i can get this kind of info?
Peace! *************
M. MARNEY
 
I can't think of any URLs off the top of my head, but I'm sure some other guys here could name some.

To be honest, I've found Tek-Tips to be one of the best sources of code. I use the keyword search a lot to see if someone else has already asked my question. I've found probably 90% of my answers that way. You'll find a lot of posted code in the FAQs and threads.

The best way to learn VBA code is to just to work with it, however for SQL syntax, I cheat and use the Query design grid to construct the query I need. I then go into SQL view and look at the syntax that it created and just cut and paste that syntax into my VBA.
Maq [americanflag]
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top