Data type mismatch??? Help

Results 1 to 2 of 2

Thread: Data type mismatch??? Help

  1. #1
    Join Date
    Dec 1969
    Posts
    989

    Default Data type mismatch??? Help

    I need some help, I have an Access DB with dates and account numbers. My Date Fields Data Types are set to Date/Time. I import the data into Access from a flat file, the date formats at import are mm/dd/yy.<BR><BR>When I query for a date I get the following error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression. <BR><BR>/AbsWeb/s_res2.asp, line 89 <BR><BR>This is my Query that gets processed:<BR><BR>select * from dob_file where ToDate = &#039 8/19/98&#039 order by AccountNo <BR><BR>My Code is:<BR><BR>Line<BR><BR>85 set conntemp=server.createobject("adodb.connection")<B R>86 cnpath="DBQ=" & server.mappath(dbname)<BR>87 conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath<BR>88 response.write(SQLTemp)<BR>89 set rstemp=conntemp.execute(SQLTemp)<BR><BR>Please can someone tell me what I am doing wrong????<BR><BR>I&#039ve tryed using CDate & DateValue to convert the format????? But nothing works... it will only work if I set the Data Type on the Access DB to Text. But we all know that would be incorrect!!!<BR><BR>Please help, that&#039s in advance....<BR><BR>Paul<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    1,671

    Default RE: Data type mismatch??? Help

    Paul,<BR>Try <BR>SELECT * FROM dob_file WHERE ToDate=#8/19/98# Order By AcountNo;<BR><BR>Access SQL uses the # sign around date types.<BR>A trick to get the proper syntax is to build your query using a GUI tool like the Access Query Builder or the Data Command Query Builder in Visual Interdev. Then just paste it into your code and put your variables in the parameters you want to dynamically change.<BR><BR>Good luck,<BR>Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •