If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Where Clause Error In The DoCmd.OpenReport
Error prompt at below code
DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between #" & strStartDate & "# And #" & strEndDate & "#" a) Error message: data type mismatch in criteria expression b) Both strStartDate and strEndDate is value from TextBox c) Example of strStartDate or strEndDate value is "11/13/2009 08:00:00" d) Try before DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between " & cdate(strStartDate) & " And " & cdate(strEndDate) & "" OR DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between " & Format(strStartDate, "\#mm/dd/yyyy hh:mm:ss\#") & " And " & Format(strEndDate, "\#mm/dd/yyyy hh:mm:ss\#") & "" but the same error message prompt e) OpnStartTime is date field f) I am using MS Access 2000 g) Tested sample value #11/10/2009# And #11/11/2009# at the query used in the report. The query works. Any further advice why the above OpenReport code doesn't work ? |
#2
|
|||
|
|||
Where Clause Error In The DoCmd.OpenReport
Format the date values as "mm/dd/yyyy" format:
DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between #" & Format(strStartDate, "mm\/dd\/yyyy") & "# And #" & Format(strEndDate, "mm\/dd\/yyyy") & "#" -- Ken Snell http://www.accessmvp.com/KDSnell/ "cheer" u56161@uwe wrote in message news:9f089480d41ad@uwe... Error prompt at below code DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between #" & strStartDate & "# And #" & strEndDate & "#" a) Error message: data type mismatch in criteria expression b) Both strStartDate and strEndDate is value from TextBox c) Example of strStartDate or strEndDate value is "11/13/2009 08:00:00" d) Try before DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between " & cdate(strStartDate) & " And " & cdate(strEndDate) & "" OR DoCmd.OpenReport "Report_Machine_Utilisation_Time", acViewPreview, , "OpnStartTime between " & Format(strStartDate, "\#mm/dd/yyyy hh:mm:ss\#") & " And " & Format(strEndDate, "\#mm/dd/yyyy hh:mm:ss\#") & "" but the same error message prompt e) OpnStartTime is date field f) I am using MS Access 2000 g) Tested sample value #11/10/2009# And #11/11/2009# at the query used in the report. The query works. Any further advice why the above OpenReport code doesn't work ? |
Thread Tools | |
Display Modes | |
|
|