When you say searchbar, I think you mean combo box.
If you use the combo box wizard, you can create a look up that will allow you to find records on your form (search for records).
You can also create two combo boxes on a form, have one look up start dates, and one look up end dates (Unique Values = Yes). Call them cboStart and cboEnd.
Then create your report or form based on a query of the data you want to see, and then in the start date criteria line of the query put:
[Forms]![frmMyFormName].[cboStart]
And on the criteria line for the end date, put:
[Forms]![frmMyFormName].[cboEnd]
Then create a button to open the form or report. You may want to add code like:
If IsNull(Me.cboStart) Or Me.cboStart = "" Then
Msgbox "Please select a start date.", vbCritical
Exit Sub
End If
If IsNull(Me.cboEnd) Or Me.cboEnd = "" Then
Msgbox "Please select an end date.", vbCritical
Exit Sub
End If
This will prevent users from pulling a report with no start or end dates.
HTH
mmcdonal
|