Filter form using a query not in the record source

shaul-r

New member
Local time
Today, 00:33
Joined
Aug 13, 2013
Messages
5
I have one form which houses all my product information via the use of a query and subforms where appropriate. I would like to filter it in order to find records missing certain information.
I want to filter the information using a combo box.
The combo box has a user friendly name (Product Dimensions) and the name of a query related to that name (qryfilter_missing_prod_dims - this query is the record source query for the form plus the query that has the missing info, the query is set to return all records that match ie. all records that are missing info).

I want to write a vba code to filter my form based on that query.
And i can't get it to work using the cmd.applyfilter (docmd.applyfilter me.cbo_missing)
I've also tried to use me.recordsource. when i do it filters perfectly, but i can no longer edit any of my data in the form.
Can someone please tell me how to filter my form using a query that is not in the native form's record source?
PLEASE. thank you so much in advance.
 
I think that all this stuff is unnecessary.

Assuming that in your form you have a control named ProdDim (bounded to the field ProdDim), create Command Buttons.
The code under the click event (for each button) should be something like this:

Code:
Private Sub cmdShow[B]No[/B]Dims_Click()
Dim strFilter As String
       strFilter = "ProdDim Is Null"
       Me.Filter = strFilter
       Me.FilterOn = True
End Sub

Private Sub cmdShow[B]Only[/B]Dims_Click()
Dim strFilter As String
       strFilter = "ProdDim Is Not Null"
       Me.Filter = strFilter
       Me.FilterOn = True
End Sub

Private Sub cmdShow[B]All[/B]_Click()
   Me.FilterOn = False
End Sub
 
Thank you for your help!

ProdDim is a subform. How would I filter the main form to return products that do not have a match on the subform?
Thank you again in advance!
 
Upload a DB (Access 2003 or 2007) with some simple data.
Not necessary all DB. Only that two tables and associated form / subform.
 

Users who are viewing this thread

Back
Top Bottom