?
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,087 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

764 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