updating tables with a form - part 2

G

Guest

I am trying the following code but am getting an error:

CurrentDb.Execute "INSERT INTO [GPS Unit Table](Stock Number, Employee ID
(Added Unit) , In Service Date) VALUES(" & Me.Stock_Number_Field_Add & ","" &
Me.Employee_ID_Field_Add & "",#" & Me.AddDate_Field & "#)", dbFailOnError

"Stock Number", "Employee ID (Added Unit)", and "In Service Date" are all
field names in the table I want to update.

The following items are the actual field names in the form:
Stock Number Field_Add
EmployeeID Field_Add
AddDate Field

Any suggestions would be appreciated. Thanks for the help.


Any suggestions?
 
J

John Spencer (MVP)

Field and table names with spaces MUST be delimited with square brackets [].

CurrentDb.Execute "INSERT INTO [GPS Unit Table]([Stock Number], [Employee ID
(Added Unit)] , [In Service Date]) VALUES(" & Me.Stock_Number_Field_Add & ","" &
Me.Employee_ID_Field_Add & "",#" & Me.AddDate_Field & "#)", dbFailOnError

You many have to use square brackets around your control names also. I don't
know, I never use spaces in my names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top