Solved

Insert Into statment - Error 3134 when inserting date field

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

738 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