I have a form named ReportList with a unbound combo box on it named List2. It shows all of my reports.
I also have 2 unbound textboxes for Begin and End Dates for the criteria.
BeginningOrderDate and EndingOrderDate
I have a command button named Preview that needs to open the Report Selected.
I don't want to hard code this into a query, is there another way?
Here is my code for the OnClick Event of the Preview command button.
Private Sub Preview_Click()
If IsNull([BeginningOrderDate]) Or IsNull([EndingOrderDate]) Then
MsgBox "You must enter both beginning and ending dates."
DoCmd.GoToControl "Beginning Order Date"
Else
If [BeginningOrderDate] > [EndingOrderDate] Then
MsgBox "Ending date must be greater than Beginning date."
DoCmd.GoToControl "BeginningOrderDate"
Else
Me.Visible = False
End If
End If
End Sub