Forums
This topic is locked
Searching for a specific date
Posted 13 Sep 2002 12:53:58
1
has voted
13 Sep 2002 12:53:58 Jeffrey Jones posted:
When i try to search for a date that is in the database using Request.QueryString i get a type mismatch. i use the values that i obtain dynamiclly with a list/menu box in a form. The dates are in the database defined as type Date/Time in access 2000.This is the error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
This is the code on the resultpage:
SELECT ID, Titel, TypePubliek, Catnaam, Programma, Korte_omschrijving, Datum, Website, Company, act2sepversie2.Provincie
FROM QRYactiviteiten
WHERE Titel LIKE '%Vartitel%' AND TypePubliek LIKE '%Varpubtype%' AND Catnaam LIKE '%VarCat%' AND Programma LIKE '%VarProg%' AND act2sepversie2.provincie LIKE '%VarProv%' AND Datum = '%VarDatu%'
VarDatu % Request.QueryString("lstDatu"

Edited by - jeffreyl on 13 Sep 2002 12:57:56
Edited by - jeffreyl on 13 Sep 2002 13:01:53
Replies
Replied 14 Sep 2002 00:25:04
14 Sep 2002 00:25:04 Ken Dobson replied:
Try changing your search field on your page from a text field to a MS Access Date field. It's treating it as text and when it goes to search on that date field, it's actually a date.
The other alternative is to change your date field in your Access database to a text field.
The other alternative is to change your date field in your Access database to a text field.
Replied 15 Sep 2002 09:03:14
15 Sep 2002 09:03:14 Jeffrey Jones replied:
Thank you i will give it a try.
Replied 15 Sep 2002 09:03:36
15 Sep 2002 09:03:36 Jeffrey Jones replied:
Thank you i will give it a try.
Replied 16 Sep 2002 01:05:11
16 Sep 2002 01:05:11 Jeffrey Jones replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Try changing your search field on your page from a text field to a MS Access Date field. It's treating it as text and when it goes to search on that date field, it's actually a date.
The other alternative is to change your date field in your Access database to a text field.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
How do i change it to an MS Access Date field
Try changing your search field on your page from a text field to a MS Access Date field. It's treating it as text and when it goes to search on that date field, it's actually a date.
The other alternative is to change your date field in your Access database to a text field.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
How do i change it to an MS Access Date field
Replied 16 Sep 2002 13:36:17
16 Sep 2002 13:36:17 David Behan replied:
<b>Change sql from</b>
AND Datum = '%VarDatu%'
<b>to</b>
AND Datum = #VarDatu#
Regards,
Dave
_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
AND Datum = '%VarDatu%'
<b>to</b>
AND Datum = #VarDatu#
Regards,
Dave
_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 16 Sep 2002 22:41:10
16 Sep 2002 22:41:10 Jeffrey Jones replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<b>Change sql from</b>
AND Datum = '%VarDatu%'
<b>to</b>
AND Datum = #VarDatu#
Regards,
Dave
_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have tried that but i get the error "Syntax error in date in query expression" i am starting to beleive that the problem might lie in the access field definition.
<b>Change sql from</b>
AND Datum = '%VarDatu%'
<b>to</b>
AND Datum = #VarDatu#
Regards,
Dave
_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have tried that but i get the error "Syntax error in date in query expression" i am starting to beleive that the problem might lie in the access field definition.