I have changed a field in my table.
strName should be datatype date
cboDateSent now has a data instead of a text value.
How do I modify the following code to make it work?
I am not getting a data mismatch.
Private Sub cmdOpenDateSentReport_Click()
On Error GoTo Err_cmdOpenDateSentReport_Click
Const conErrorEmptyField = 94
Dim strName As String
Dim strDocName As String
strName = Me.cboDateSent
strDocName = "rptDateSent"
If strName = "All Dates" Then
DoCmd.OpenReport strDocName, acPreview
Else
DoCmd.OpenReport strDocName, acPreview, , "DateSent1= '" & strName & " ' OR DateSent2= '" & strName & " ' OR DateSent3= '" & strName & " '"
End If
Exit_cmdOpenDateSentReport_Click:
Exit Sub
Err_cmdOpenDateSentReport_Click:
If Err.Number = conErrorEmptyField Then
MsgBox ("Please select a date")
Else
MsgBox Err.Description
End If
Resume Exit_cmdOpenDateSentReport_Click
End Sub
strName should be datatype date
cboDateSent now has a data instead of a text value.
How do I modify the following code to make it work?
I am not getting a data mismatch.
Private Sub cmdOpenDateSentReport_Click()
On Error GoTo Err_cmdOpenDateSentReport_Click
Const conErrorEmptyField = 94
Dim strName As String
Dim strDocName As String
strName = Me.cboDateSent
strDocName = "rptDateSent"
If strName = "All Dates" Then
DoCmd.OpenReport strDocName, acPreview
Else
DoCmd.OpenReport strDocName, acPreview, , "DateSent1= '" & strName & " ' OR DateSent2= '" & strName & " ' OR DateSent3= '" & strName & " '"
End If
Exit_cmdOpenDateSentReport_Click:
Exit Sub
Err_cmdOpenDateSentReport_Click:
If Err.Number = conErrorEmptyField Then
MsgBox ("Please select a date")
Else
MsgBox Err.Description
End If
Resume Exit_cmdOpenDateSentReport_Click
End Sub