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

Error in append query: Too few parameters, expected 1

Status
Not open for further replies.

projecttoday

Programmer
Joined
Feb 28, 2004
Messages
208
Location
US
I am trying to add some new records to a table from records in another table. (This cannot be avoided). So, it's a read-write loop, given below. On the Currentdb.Execute statement I get the error message "Too few parameters, expected 1". Does anyone know how to correct this? Robert

SQLstr = "SELECT modelid FROM tblReservations WHERE reservationsmainid = " & Forms.frmreslist.lstReservations

Set db = CurrentDb()
Set rs = db.OpenRecordset(SQLstr)

rs.MoveFirst
Do Until rs.EOF
SQLstr = "INSERT INTO tblRentaldetails (rentalid) VALUES (ShowIdentity)"
CurrentDb.Execute SQLstr, dbFailOnError '< I get error here
rs.MoveNext
Loop
 
I have found the problem. Please disregard. Thanks.
 
I imagine that ShowIdentity does not have a value.

You probably need:

SQLstr = "INSERT INTO tblRentaldetails (rentalid) VALUES ('" & ShowIdentity & ')"

Possibly rs!ShowIdentity?
 
Forgot now what it was but that wasn't it. I'm starting a new thread so have a look at that one if you have time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top