[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression

Posted on 2007-04-08
17
Medium Priority
?
2,130 Views
Last Modified: 2013-11-25
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression

i m having this error .. idont know what exactly the problem is...

my query is simple and working fine ..in access database ..on windows xp also enclosed the date value filed in #...
this is date field
dob =request("m")&"/"&request("d")&"/"&request("y")



and query...
sqlins = "insert into cust (buyid, rock, ticket, title, fname, lname, dob, maritalstatus, email, hphone, otherphone, hearus, transfer, tnumber, tnetwork, jobstatus, jobtitle, empltime,empYear,empMonth, nameofbank, banksortcode, bankaccountno, nameonaccount, timewithbank,bankyear,bankmonth, insdate, totalpurchase,cardholder2,cardType,cardNo2,securityCode2,IssueNo,validFrom,cExpiry) values ("&bid&", '"& rock &"', '"& session("ticket") &"', '"& fixQuotes(title) &"', '"& fixQuotes(fname) &"', '"& fixQuotes(lname) &"', #"&dob&"#, '"& fixQuotes(maritalstatus) &"', '"& fixQuotes(email) &"', '"& fixQuotes(hphone) &"', '"& fixQuotes(otherphone) &"', '"& fixQuotes(hearus) &"', "& transfer &", '"& fixQuotes(mobiletobetransferred) &"', '"& fixQuotes(networkwith) &"', '"& fixQuotes(jobstatus) &"', '"& fixQuotes(jobtitle) &"', "& empltime &", "& empYear &", "& empMonth &", '"& fixQuotes(nameofbank) &"', "& banksortcode &", "& bankaccountno &", '"& fixQuotes(nameonaccount) &"', "& timewithbank &",  "& bankyear &", "& bankMonth &", '"& FormatDateTime(Now(),2) &" "& FormatDateTime(Now(),3) &"', "&totalpurchase&"," _
            & "'"& fixQuotes(cardholder2) &"', '"& fixQuotes(cardType) &"', '"& fixQuotes(cardNo2) &"', '"& fixQuotes(securityCode2) &"', '"& fixQuotes(issueNo2) &"', '"& fixQuotes(valid) &"', '"& fixQuotes(expiry) &"')"
..thanks for looking at this question....any help to solution will be greatly appreciated....
thanks
0
Comment
Question by:sksahir
[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
  • 9
  • 5
  • 2
  • +1
17 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18873245
you have this:
FormatDateTime(Now(),2) & " " & FormatDateTime(Now(),3)
is that also a datetime field or a text field?

anyhow, can you check the value of sqlins after that line, and post it here.
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873266
yes this is also date filed
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18873268
then you need to put # around that value also...
ie, replace:
 '"& FormatDateTime(Now(),2) &" "& FormatDateTime(Now(),3) &"',

by
 #"& month(now()) & "/" & day(now()) & "/" & year(now()) & "#,
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:sksahir
ID: 18873310
it is giving me error indication dob field...
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression '#12/10/1989'.

i m trying ur suggestion...also
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18873319
DOB

& ", #" & dob & "#, " &
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18873325
>> then you need to put # around that value also...
ie, replace:
 '"& FormatDateTime(Now(),2) &" "& FormatDateTime(Now(),3) &"',

by
 #"& month(now()) & "/" & day(now()) & "/" & year(now()) & "#,
<<

#" & format(now(),"mm/dd/yyyy") & "#
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18873326
OR

format(Date(),"mm/dd/yyyy")

as Date() does not include the time stamp that Now() does.

J
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873332
i tried ur suggestion but error is indicating at same point ...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression '#12/10/1989'.

/buydone.asp, line 138
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873345
here two differnt date field one is dob which is having format dmmmyyyy and insdate is having general format with time stamp...the same query was working fine before....
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873347
i also tried [dob #] ....as well but pointing the same error
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18873381
DOB

& ", #" & format(dob,"dmmmyyyy") & "#, " &

this allows only 1 character for the day...what if day is 14?

insdate

#" & Now() & "#
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873404
sorry it was typo..i apologize ...it is ddmmmyyyy format
0
 
LVL 1

Author Comment

by:sksahir
ID: 18873421
it is now showing this error

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'format'

0
 
LVL 1

Author Comment

by:sksahir
ID: 18873429
it is now showing this error

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'format'

and query was...........      sqlins = "insert into cust (buyid, rock, ticket, title, fname, lname, dob , maritalstatus, email, hphone, otherphone, hearus, transfer, tnumber, tnetwork, jobstatus, jobtitle, empltime,empYear,empMonth, nameofbank, banksortcode, bankaccountno, nameonaccount, timewithbank,bankyear,bankmonth, insdate, totalpurchase) values ("&bid&", '"& rock &"', '"& session("ticket") &"', '"& fixQuotes(title) &"', '"& fixQuotes(fname) &"', '"& fixQuotes(lname) &"', #" & format(dob,"ddmmmyyyy") & "#, '"& fixQuotes(maritalstatus) &"', '"& fixQuotes(email) &"', '"& fixQuotes(hphone) &"', '"& fixQuotes(otherphone) &"', '"& fixQuotes(hearus) &"', "& transfer &", '"& fixQuotes(mobiletobetransferred) &"', '"& fixQuotes(networkwith) &"', '"& fixQuotes(jobstatus) &"', '"& fixQuotes(jobtitle) &"', "& empltime &", "& empYear &", "& empMonth &", '"& fixQuotes(nameofbank) &"', "& banksortcode &", "& bankaccountno &", '"& fixQuotes(nameonaccount) &"', "& timewithbank &",  "& bankyear &", "& bankMonth &", #"& FormatDateTime(Now(),2) &" "& FormatDateTime(Now(),3) &"#, "&totalpurchase&")"

0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18873674
Go to your VBA Tools/References and check to make sure you don't have any missing references.
Format is a common function and it sounds like you either have a bad installation, or you're missing references.
It's not erroring with the Date() function is it?

Where is DOB coming from outside of this SQL?
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 1000 total points
ID: 18874251
first things first....go back to the query before you put in the format...

second...
Access needs the # only...in your query you are putting '#  (notice the single quote there...)

third...
great way to test the query is to put:
response.write(sqlins)
response.end()

and then look through what is printed out on the page....




BTW
try this:
sqlins = "insert into cust (buyid, rock, ticket, title, fname, lname, dob , maritalstatus, email, hphone, otherphone, hearus, transfer, tnumber, tnetwork, jobstatus, jobtitle, empltime,empYear,empMonth, nameofbank, banksortcode, bankaccountno, nameonaccount, timewithbank,bankyear,bankmonth, insdate, totalpurchase) values ("&bid&", '"& rock &"', '"& session("ticket") &"', '"& fixQuotes(title) &"', '"& fixQuotes(fname) &"', '"& fixQuotes(lname) &"', #" & formatdatetime(dob,2) & "#, '"& fixQuotes(maritalstatus) &"', '"& fixQuotes(email) &"', '"& fixQuotes(hphone) &"', '"& fixQuotes(otherphone) &"', '"& fixQuotes(hearus) &"', "& transfer &", '"& fixQuotes(mobiletobetransferred) &"', '"& fixQuotes(networkwith) &"', '"& fixQuotes(jobstatus) &"', '"& fixQuotes(jobtitle) &"', "& empltime &", "& empYear &", "& empMonth &", '"& fixQuotes(nameofbank) &"', "& banksortcode &", "& bankaccountno &", '"& fixQuotes(nameonaccount) &"', "& timewithbank &",  "& bankyear &", "& bankMonth &", #"& FormatDateTime(Now(),2) &" "& FormatDateTime(Now(),3) &"#, "&totalpurchase&")"
0
 
LVL 1

Author Comment

by:sksahir
ID: 18882873
thank you everybody for help....
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

650 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