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:
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:
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.
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.