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.
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.
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?
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)
I know I have used filter by form before and the dropdown lists contain what is actually in the field. Is there anyway to get this data to appear instead of Is Null or Is not Null?
'Invalid use of Null'.
if I use another table for a string value for the same recordset, the code works and the combobox gets populated with the unique names of the field selected.
I tried to retrieve the values for different fields from the table tblPlants, but I get the same error.
It appears that I cannot populate the combobox with any of the field values from the tblPlants. But the values are not Null - by using the code line for the MsgBox (msg), I am able to see the values in the MsgBox.
Or is it some other criteria I am missing?
All I want is to select a customer from the combobox, click the cmd button(CustomerSearchCommand) and have the report (CustomerSearchRa) filter the report to the value in the combobox(combo5)
In trying different things I've gotten confused on what my original code was for this command button.
As of now, I have tried to implement this and as I select any value from the first combobox of row 1 I see the second combobox of the same row gets populated but as I go on selecting values from the first set of comboboxes I see that the values in the second set of the comboboxes above changing or becoming null.
The 1st combobox is cboRCMTask: