S
shn
I am receiving a Runtime Error 3464 Data type mismatch in criteria
expression. This form worked prior and now does not work. Below is the
code. During Debugging the (DoCmd.OpenReport strReport,
acViewPreview, , strWhere) is highlighted. Please Help.
Private Sub btn_UpdatedReportBuild_Click()
Dim strReport As String 'Name of report to Open.
Dim strField As String 'Name of date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "rptCourses"
strField = "tblcourse.DateChanged"
If IsNull(Me.txtupdatedfrom) Then
If Not IsNull(Me.txtupdatedto) Then 'End date, but no start
date.
strWhere = strField & " <= " & Format(Me.txtupdatedto,
conDateFormat)
End If
Else
If IsNull(Me.txtupdatedto) Then 'Start date, but no end.
strWhere = strField & " >= " & Format(Me.txtupdatedfrom,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " &
Format(Me.txtupdatedfrom, conDateFormat) & " And " &
Format(Me.txtupdatedto, conDateFormat)
End If
End If
Debug.Print strWhere
DoCmd.OpenReport strReport, acViewPreview, , strWhere
expression. This form worked prior and now does not work. Below is the
code. During Debugging the (DoCmd.OpenReport strReport,
acViewPreview, , strWhere) is highlighted. Please Help.
Private Sub btn_UpdatedReportBuild_Click()
Dim strReport As String 'Name of report to Open.
Dim strField As String 'Name of date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "rptCourses"
strField = "tblcourse.DateChanged"
If IsNull(Me.txtupdatedfrom) Then
If Not IsNull(Me.txtupdatedto) Then 'End date, but no start
date.
strWhere = strField & " <= " & Format(Me.txtupdatedto,
conDateFormat)
End If
Else
If IsNull(Me.txtupdatedto) Then 'Start date, but no end.
strWhere = strField & " >= " & Format(Me.txtupdatedfrom,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " &
Format(Me.txtupdatedfrom, conDateFormat) & " And " &
Format(Me.txtupdatedto, conDateFormat)
End If
End If
Debug.Print strWhere
DoCmd.OpenReport strReport, acViewPreview, , strWhere