I have a Main form called Assets (Navigation sub-form). It has two sub-forms. The sub-form Asset_Trans (displayed as Asset Tracking on the form), contains a Site field, a combo-box which contains the name of a Site where the asset is located.
I need to filter the Assets in the main form, based on the Site control in the sub-form (covered up, in the image below, by the error message). I created a combo-box in the main form that allows selecting a Site from the Sites Table. Then I created an Event Procedure to filter the Assets by the selected Site.
I have been working with this code, but can't quite get it to work. The code is returning the target Site text, as can be seen in the error message in the image below. It needs, quotes around the value returned by the combo-box, but I haven't been able to figure out how to get them in. I suppose there is an obvious solution, but it escapes me. Anything I try, to put quotes around the result, just makes it worse.
After I get this working, I'll likely change out the filter combo-box with an Option Group, so I can cancel the filter as well.
Code:Private Sub Filter_Site_Click() Me.Filter = "Me![Asset_Trans]!Form![Site] = " & [Filter_Site].Column(1) DoCmd.RunCommand acCmdApplyFilterSort End Sub