I am working in Access 2013 and have created a form to streamline data entry for some inspections. There are hundreds of assets to be inspected, but the ID code assigned to each asset is based on codes assigned to roadway intersections, meaning that one intersection code could have up to 5 assets assigned to it. The asset code is attached as a suffix to the intersection code to create a unique ID for each asset. The record source for the form is the table with all the inspection data (here, called Table1 for simplicity).
Instead of scrolling through a combo box with all the assets to update records, I created two find-duplicate queries; one for the intersections (text field) and one for the asset codes (text field). These query results are used to populate two different combo boxes on the form. The user first chooses the intersection and then the asset ID to update. I have an event handler that fires (After Update) after the asset ID is selected. The VBA code below filters the form based on the values in both combo boxes. It should return one record for editing.
Private Sub cboAssetID_AfterUpdate()
Me.Filter = "((([Table1].Intsxn) Like " & cboIntsxn & ") AND (([Table1].AssetID) Like " & cboAssetID & "))"
Me.FilterOn = True
End Sub
If I start with only the Intersection filter, it works fine. If I add the second filter criteria, I am being asked for a parameter for the asset ID, even after entering it on the form so I can only conclude the problem is in my syntax. I tried this same type of statement when working with integer fields and had no problems.
I appreciate someone being able to point me in the right direction when using multiple text criteria to filter a form.
Thanks for your consideration!
Instead of scrolling through a combo box with all the assets to update records, I created two find-duplicate queries; one for the intersections (text field) and one for the asset codes (text field). These query results are used to populate two different combo boxes on the form. The user first chooses the intersection and then the asset ID to update. I have an event handler that fires (After Update) after the asset ID is selected. The VBA code below filters the form based on the values in both combo boxes. It should return one record for editing.
Private Sub cboAssetID_AfterUpdate()
Me.Filter = "((([Table1].Intsxn) Like " & cboIntsxn & ") AND (([Table1].AssetID) Like " & cboAssetID & "))"
Me.FilterOn = True
End Sub
If I start with only the Intersection filter, it works fine. If I add the second filter criteria, I am being asked for a parameter for the asset ID, even after entering it on the form so I can only conclude the problem is in my syntax. I tried this same type of statement when working with integer fields and had no problems.
I appreciate someone being able to point me in the right direction when using multiple text criteria to filter a form.
Thanks for your consideration!