Question question about combobox filter

beefwellington

Registered User.
Local time
Today, 13:57
Joined
Jul 27, 2009
Messages
14
I have a form with a combobox that filters a subform based on the location selected from the combo box. When the combobox "change" event fires off, the follow code gets executed:

Code:
Private Sub cboSelectArea_FAB_Change()

If Me.cboSelectArea_FAB = "All Areas" Then
    Me.sfrmEquipmentStatusList_Maintenance.Form.FilterOn = False
    Me.sfrmEquipmentStatusList_Maintenance.Form.Filter = ""
Else
    Me.sfrmEquipmentStatusList_Maintenance.Form.FilterOn = False
    Me.sfrmEquipmentStatusList_Maintenance.Form.Filter = "[LocationName]='" + Format(Me.cboSelectArea_FAB.Value) + "'"
    Me.sfrmEquipmentStatusList_Maintenance.Form.FilterOn = True
End If

End Sub

When I select a location from the combobox, a popup window appears that says:

Window Title: "Enter Parameter Value"
Window Message: "LocationName" with a textbox below.
Options: "OK" or "Cancel"

If I press Cancel, I get a "Run-time Error '2001'. And the last line of my Else statement is highlighted:
Code:
Me.sfrmEquipmentStatusList_Maintenance.Form.FilterOn = True

If I fill in a location from the combobox and press OK, it will display results ONLY for that location OR if I select "All Areas" from the combobox.

Any help would be appreciated. If you need more info, let me know and I will provide it. Thanks.
 
some things to try:
- use the After Update event
- change the + sign of the criteria to an ampersand (&)
- also in the critera, remove the formatting:
Format(Me.cboSelectArea_FAB.Value) -- change to just --> Me.cboSelectArea_FAB
 
some things to try:
- use the After Update event
- change the + sign of the criteria to an ampersand (&)
- also in the critera, remove the formatting:
Format(Me.cboSelectArea_FAB.Value) -- change to just --> Me.cboSelectArea_FAB

I tried all these but no dice. :(


UPDATE: OK so I found out the SQL query never grabs the field "LocationName". This was my mistake. I'm working on a database thats a few years old and the person who made it no longer works here. I'm still figuring out there system but thanks for the help. I'll keep these suggestion in mind if I run into this problem again.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom