How to filter form when value selected from combobox is null?
Thank you for taking the time to report an issue.
What's wrong... Please write below.
Can someone just point me to a simple VBA example of a combobox with list values that filter a form on the value selected in the combobox.
The combobox is on the form its suppoused to filter
I need to populate a combobox filter on a subform based on what is selected on a filter combobox on my mainform but no matter what I try I can't seem to get this to work.
I can populate the combobox filter on the subform using a normal combobox on that same form but can't populate the combobox filter on the subform using the filter on the main form.
I am aware that there is different syntax used to access a control on a subform and am 100% sure my syntax is perfect.
I've got an unbound combobox with a default value, but I still would like users to enter a Null value. I've got the Null value in the list of drop down items, but when it is selected, the combox value does not go to null, but instead goes to the default value.
Any easy way to allow null values to be selected? I know it was possible with older versions of Access, but not any more.
My Form is: frmReview
My ComboBox is: cmbGLimpact
The RowSource is: SELECT DISTINCT [GLimpact] FROM Initiatives UNION SELECT Null As AllChoice FROM Initiatives ORDER BY [GLimpact] DESC;
The Query Criteria is: [Forms]![frmReview]![GLimpact]
The field values are: Yes, No & TBD
The filter works fine for Yes, No & TBD, but the blank choice doesn't return all records.
I need to be able to setup several filter ComboBoxes to enable filtering on several different fields. So, depending on which ComboBox filter (field) the user wants to filter on, the otherswill allow all records to be returned.
I.e. - filter the records based on the value selected in first combo box and if the value of the combo is null to display all the records.
if I select a value from the second combo to filter the records accordingly (keeping the filter of the first combo) and if the value of the second combo is null to display all the records (keeping the filter of the first combo if a value is selected).
The combobox filter does not work in View mode though - is there any way to fix this?
I know how to filter records in the subform using a query based on the combobox, but not how to filter the fields themselves.
I have a table like this:
Name Mo1 Mo2 Tu1 Tu2 We1 We2 Th1 Th2 Fr1 Fr2
For each name, a record can be marked as 'absent' or 'present' in the other fields.
I want a combobox that lists the days of the week, and if eg Monday is selected, the subform displays this:
Name Mo1 Mo2
(for each record)
Private Sub Combo11_AfterUpdate()
Me.Filter = "Supervisor_ID=" & Me.Combo11 & ""
Me.FilterOn = True End Sub
But it prompts for the supervisor ID, even though the code shows that the value passed should be correct. If I manually enter the ID in the prompt, the filter applies as how I was expecting the code would work. Any insight
Private Sub Combo9_AfterUpdate()
Form.filter = "RepairID = '" & Me.Combo9.Value & "'"
Form.FilterOn = True
There's something wrong, the filter did not work.
Could somebody give me some suggestion?
Now I found code on getting this to work and it works great except for one minor flaw that I am trying to add to it. If the user goes to clear the combobox thus making the value null the Msgbox appears asking for the users password but fails each time because the null username does not exist.
I'm trying to make theproper if statement to check and see if the username selected from the combobox does not exist in the usertable then it just cancels the update statement.
(between I did not make this code I borrowed it from another forum)