A family of Microsoft relational database management systems designed for ease of use.
Try this:
Private Sub cmdOpenReport_Click()
Dim strWhere As String
If Not IsNull(Me.txtStartDate) And Not IsNull(Me.txtEndDate) Then
strWhere = "[DateField] Between #" & Format(Me.txtStartDate, _
"mm/dd/yyyy") & "# And #" & Format(Me.txtEndDate, _
"mm/dd/yyyy") & "#"
ElseIf Not IsNull(Me.txtSpecificDate) Then
strWhere = "[DateField] = #" & Format(Me.txtSpecificDate, _
"mm/dd/yyyy") & "#"
Else
MsgBox "Please fill in either start and end date or specific date"
Exit Sub
End If
DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, _
WhereCondition:=strWhere
End Sub
Substitute the correct names for the command button (cmdOpenReport), the date/time field (DateField) and the report (rptMyReport).