Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Insert Into statment - Error 3134 when inserting date field

Posted on 2002-05-29
4
Medium Priority
?
205 Views
Last Modified: 2012-06-27
What in the world is wrong with this simple line of code?

 dbs.Execute "INSERT INTO tempBankStatement (category, amount, date) VALUES ('Beginning Balance', " & myBegBal & ", #" & StartDate & "#);"

it keeps running "Error 3134 syntax error in INSERT INTO STATEMENT"

i've been fooling around with this for an hour!  it runs the error even if i insert a test date.

(eg.
dbs.Execute "INSERT INTO tempBankStatement (category, amount, date) VALUES ('Beginning Balance', " & myBegBal & ", #7/1/2000#);"

i've changed the format of the date, used chr(35) etc.

the statement works fine if i remove the date information.

help!
0
Comment
Question by:laurap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:vbDoc
ID: 7042329
Try replacing the # with a single quote '. ('7/1/2000')
regards,
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7042331
have you tried renaming your "date" column to something other than the keyword date?

ie)
INSERT INTO tempBankStatement (category, amount, myDate <--)

0
 
LVL 5

Accepted Solution

by:
raizon earned 200 total points
ID: 7042369
If your DB is an Access DB then using the # is correct.  However I agree with bobbit that you need to take a look at your column 'date'.  If you want to keep it date then in your sql statment you need to wrap it with brackets.

(eg.
dbs.Execute "INSERT INTO tempBankStatement (category, amount, [date]) VALUES ('Beginning Balance', " &
myBegBal & ", #7/1/2000#);"

0
 

Author Comment

by:laurap
ID: 7042386
thanks for everyone's help..........
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question