Solved

Insert Into statment - Error 3134 when inserting date field

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now