Solved

Insert Into statment - Error 3134 when inserting date field

Posted on 2002-05-29
4
201 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
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 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

679 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