C
cheer
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 ?
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 ?