Forums

This topic is locked

Data type mismatch

Posted 09 Sep 2001 12:47:44
1
has voted
09 Sep 2001 12:47:44 Alain Uy posted:
Hello to all!
im having a trouble of querying my recordset, everytime i tried to query the db using a date field i get this exact error:

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

im wondering if it is still applicable of querying a date field, in my db my date field is set to have a default value of Date() so it will enter the present date everytime someones gonna insert some records... please do help!!! im stuck in this little problem of mine... thanks in advance

Replies

Replied 09 Sep 2001 16:21:41
09 Sep 2001 16:21:41 Owen Eastwick replied:
Let's see the code for the SELECT statement.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 09 Sep 2001 21:19:14
09 Sep 2001 21:19:14 Alain Uy replied:
Sir,

i have 2 pages, one is consist of a textfield (txtdate) to enter the date
ex. 09/02/2001 with a post method in the form. on the result page,
i have the sql statement:

---
SELECT *
FROM table1
WHERE trandate like 'vardate'
---


where variable 'vardate':
Default Value = %
Run-time Value = request.form("txtdate"

then, boom! the error message, the only thing that is in my mind is the
default value of the trandate field that i had set in the db the value is
date(), i think.....

thanks sir!


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Let's see the code for the SELECT statement.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 10 Sep 2001 09:07:14
10 Sep 2001 09:07:14 Owen Eastwick replied:
The reason you're getting the error is because you are searching for <b>vardate</b> as a text string.

When you refer to a variable with LIKE and enclose it in quotes it is treated as text, try this:

SELECT *
FROM table1
WHERE trandate = vardate

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Edited by - oeastwick on 09/10/2001 09:08:08
Replied 11 Sep 2001 09:45:22
11 Sep 2001 09:45:22 Alain Uy replied:
Sir Owen,
im on the right track now sir... thanks for the help and actually im visiting the tutorial site also the advance search tutorial

Thanks Alot!!!

Alain.

Replied 12 Sep 2001 08:18:35
12 Sep 2001 08:18:35 Owen Eastwick replied:
Alain,

I haven't been knighted yet, just Owen will do.<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Reply to this topic