Reputation: 347
Im trying to figure out if there is a way to link a data range which is encompassed in two textboxes with the calender button to select a date and 3 other filtering combo boxes. I want the combo boxes to filter off of each other based on the date of the record. Does anybody know if this is possible?
Thanks so much!
Private Sub cmbFleetID_AfterUpdate()
Me.cmbOwner.Requery
Me.cmbTailNumber.Requery
End Sub
Private Sub cmbOwner_AfterUpdate()
Me.cmbFleetID.Requery
Me.cmbTailNumber.Requery
End Sub
Private Sub cmbTailNumber_AfterUpdate()
Me.cmbFleetID.Requery
Me.cmbOwner.Requery
End Sub
This is the code I have so far. As you can see I have the combo boxes cascading off of each other with the code in the queries for each combo box as well [forms]![ReportNavigation]![cmbName]. I just cant figure out how to put the date range text boxes into it.
Upvotes: 0
Views: 827
Reputation: 8557
So the user will enter a date range and the three comboboxes will automatically update/requery themselves based on the date range entered?
If so, in the RowSource
field of the combobox, build your query to access these fields in the form like this:
SELECT tblTestData.ID, tblTestData.ACName, tblTestData.ActiveDate FROM tblTestData WHERE (((tblTestData.ActiveDate) Between [Forms].[frmTest].[txtDateBegin] And [Forms].[frmTest].[txtDateEnd]));
Clearly, you have to replace the frmTest
with your form name and txtDateBegin/End
with your textbox names. With this RowSource, each requery will appropriately pull the data from your table.
Upvotes: 1