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!

INSERT INTO - "Too few parameters" error 1

Status
Not open for further replies.

pjtarheel

Technical User
Jan 14, 2005
14
US
I am trying to track all changes made to records in a table by creating a duplicate of the updated record in another table (with the same fields and field names)

I'm trying to use the following code to insert the record:

Private Sub Form_AfterUpdate()
Dim db As Database

Set db = CurrentDb
db.Execute "INSERT INTO [tbl_GROUP-INFO-CORRECTIONS] " _
& " SELECT * FROM [tbl_GROUP-INFO] WHERE " _
& " [tbl_GROUP-INFO].[GroupID]= Me![GroupID];"
Set db = Nothing
End Sub

I am getting the following error message:
"Run-time error '3061': Too few parameters. Expected 1."

Can anyone help me with this?

Also, if anyone has a better suggestion for tracking record changes, I would love to hear that, too!

Thanks!
 
Try entering the value of the form reference, in stead of the reference:

[tt]db.Execute "INSERT INTO [tbl_GROUP-INFO-CORRECTIONS] " _
& " SELECT * FROM [tbl_GROUP-INFO] WHERE " _
& " [tbl_GROUP-INFO].[GroupID]= " & Me![GroupID][/tt]

Should groupid be a text, it would need single quotes (text delimiters)

Roy-Vidar
 
Thanks!

The single quotes tip helped a lot, too, since I had previously tried what you suggested, but without the single quotes (GroupID is a text field).

I've been knocking this around for longer than I care to admit. Thanks a ton!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top