Filtering subform

Hakello

Registered User.
Local time
Today, 16:39
Joined
Apr 18, 2013
Messages
23
I'm sorry, but I can't figure out how this is supposed to work even though there are tons of threads on this already :banghead:

I have a NAV form where someone can select 3 values from comboboxes. By clicking a button (which checks if all values have been filled) you open up a triple layered nested pop-up form which should filter on these values. The first filter works fine (it is applied when opening the mainform) and I can fill textboxes in the main form with the data of the other 2 filters.

But I can't transfer the information to the subforms because I don't know the proper way to refer to them. I keep getting all kinds of errors.

What is the proper way to filter a continues subform? And a subform of a subform? Preferably this would happen when clicking the button that opens up the pop-up in the first place but after I couldn't get that to work I tried filtering from the popup itself

Some examples of what I tried:

From the main form
Code:
Me.SUBFORMNAME.Filter =
From the button
Code:
Forms!MainForm!SubFormField.form.Filter =  
Forms!MainForm!SubFormField.form.FilterOn = True
From the subform itself
Code:
 = Parent!FieldName

- EDIT -
Apparantly a night of sleep can fix stupidity. If anyone else ever has this issue please make sure you are refering to the -name- of the object that is your subform and not to the name you gave your subform like you can with main forms :rolleyes: When you place a textbox its named tb2 or whatever, and when a wizard creates a subform it names it form2 (or whatever) and not your form name.
 
Last edited:
Thanks Eugin, I think I came across that site while googling before and its indeed very(!) usefull but I still get errors :P

Following the matrix, I take the 'not in these forms' for filtering sub1 and get the following code:

Code:
Forms!POP_Cijferinvoer!POP_CijferinvoerSUB.Form.Filter = "[toetscode] = '" & stToetsfilter & "'"

Gives me an error "Method 'Item' of Object 'Forms' failed". Which prob means I'm still not referencing properly.

Code:
Forms("POP_Cijferinvoer").tbFilterToets = stToetsfilter
I use this code to set a test textbox in the main form from the NAVform when the button is pressed (which works fine), but using that syntax here still gives errors.
 
Last edited:
What is the Form hierarchy? What is the main form, subform1, subform2?
 
-EDIT-

Solved - see first post
 
Last edited:

Users who are viewing this thread

Back
Top Bottom