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!

Too few parameters. Expected 1

Status
Not open for further replies.

rmtiptoes

IS-IT--Management
Mar 30, 2004
55
US
I have the following code and I am receiving the error:

Too few parameters. Expected 1

I know its the delimeters and I have tried every combination around the fUser variable yet I always get this error. I have no idea what is wrong.


Private Sub Form_AfterUpdate()
Dim db As Database
Dim fUser As String
fUser = CurrentUser()

Set db = CurrentDb
db.Execute "INSERT INTO Building ([ID Number],[Lot],[Block],[User])" _
& " SELECT [ID Number],Lot,Block,"'& fUser & '" FROM City WHERE " _
& "[ID Number]=" & Me![ID Number]

Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.

 
Try:

[tt]db.Execute "INSERT INTO Building ([ID Number],[Lot],[Block],[User])" _
& " SELECT [ID Number],Lot,Block,'"& fUser & "' FROM City WHERE " _
& "[ID Number]=" & Me![ID Number][/tt]

But wouldn't this have thrown a compile error - do you use Option Explict? I gather ID Number is numeric, else it would also need single quotes.

Roy-Vidar
 
You guys are great, that worked and yet I thought I tried it. I have no Option Explicit and yes ID number is numeric.

thanks a million!!!

Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top