Here is a sub that uses two text boxes on a form and a command button. You enter the begin date and the end date and press the button. The report will then be opened with the data between the dates. I also added a way to stop the process and prompt the user if they try to open a report without putting in the date.
Dim bProcOk As Boolean
bProcOk = True
' The following IF Then series checks for null values in
' the stated txtbox. If a null is found the error message
' is displayed and the focus is sent back to form control
If IsNull(Me.txtBeginDate) Then
MsgBox "You must provide a beginning date!", vbExclamation, "Error"
txtBeginDate.SetFocus
bProcOk = False
Else
If IsNull(Me.txtEndDate) Then
MsgBox "You must provide a ending date!", vbExclamation, "Error"
txtEndDate.SetFocus
bProcOk = False
End If
End If
If bProcOk Then ' If the above IF Thens are satisfied
' the following command is carried out
DoCmd.OpenReport "EmpContactLog", acPreview, , _
"[date]>=#" & Me![txtBeginDate] & "# And [date]<= #" & _
Me![txtEndDate] & "#"
' Opens the report based on the begin and end date
End If
End Sub