When code runs appends 2 lines to table

Paul1100

Registered User.
Local time
Today, 09:54
Joined
May 4, 2013
Messages
17
Hi,

I have a problem when i run this form and it completes ok but it tells me that 2 lines will be appended to my table!! both lines are identical the data is correct but don't know why i get two? my code for Access 97 follows:

DoCmd.RunSQL "INSERT INTO[OverRide Table]([ProductID],[EmployeeNumber],[Date])Select[Forms]![OverRide Table].[ProductID],[Forms]![OverRide Table].[EmployeeNumber],[Forms]![OverRide Table].[Date & Time]FROM[AuthorizedUsertoOverRide]"

I hope someone can help me. I'm still just learning this!!!!

Paul
 
If I had to guess, there are 2 records in AuthorizedUsertoOverRide. Since your values all come from the form, use the VALUES clause:

INSERT INTO TableName(FieldList)
VALUES(FieldList)
 
Your are exactly right pbaldy i do have two records in the AuthorizedUsertoOverride table however i am not sure where to insert the values option into my statement? does the Values replace Select or is this and totally new added parameter?
 
It replaces it.
 
now i get a run time error 3137 missing semicolon ; at end of sql statement
new code below:

DoCmd.RunSQL "INSERT INTO[OverRide Table]([ProductID],[EmployeeNumber],[Date])Values([Forms]![OverRide Table].[ProductID],[Forms]![OverRide Table].[EmployeeNumber],[Forms]![OverRide Table].[Date & Time]) FROM[OverRide Table]"
 
The example I posted above was all of it. In other words, drop the FROM clause. Also, make sure you have a space before Values.
 

Users who are viewing this thread

Back
Top Bottom