1

I'm working on a program in MS Access, and I'm just trying to enter some data into a test table to see how it works. I can't for the life of me see what is wrong with the syntax.

I'm getting a 3134 error code.

Maybe there is a reserved word I'm using? All of the data are strings (even things that probably should be something else). I changed them to strings to try and figure out what the problem is).

CurrentDb.Execute " INSERT INTO TempReg " _
              & "(Timestamp, LName, FName, Grade, InventoryNumber, SerialNumber, MacAddress, PaidIn, CheckNum) VALUES " _
              & "('test', 'test2', 'test', 'test', 'test', 'test', 'test', 'test', 'test');"

Just for fun, when I run the following code it works fine. I don't see what is fundamentally different.

CurrentDb.Execute " INSERT INTO TestTable " _
              & "(SampleText, MoreText) VALUES " _
              & "('test', 'test2');"

Thank you!

2 Answers 2

1

TimeStamp is a reserved word, as per https://support.office.com/en-us/article/learn-about-access-reserved-words-and-symbols-ae9d9ada-3255-4b12-91a9-f855bdd9c5a2
You should change that field name, or try putting the name within [brackets] in your statement.

Sign up to request clarification or add additional context in comments.

Comments

1

Try to put field names in square brackets:

CurrentDb.Execute "INSERT INTO TempReg " _
              & "([Timestamp], [LName], [FName], [Grade], [InventoryNumber], [SerialNumber], [MacAddress], [PaidIn], [CheckNum]) VALUES " _
              & "('test', 'test2', 'test', 'test', 'test', 'test', 'test', 'test', 'test');", dbFailOnError

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.