SubForm control SubForm

JaedenRuiner

Registered User.
Local time
Today, 13:01
Joined
Jun 22, 2005
Messages
154
Okay,

I have a Form with two sub forms on it.
I'll call them
Form: MainForm
Ctrls: SubForm1, SubForm2
Form: SubForm_1
Form: SubForm_2

Very simple.
Now, in SubForm1 I have tried the following all to no avail:

Code:
Dim frm as Form

Set frm = Me.Parent.SubForm2.Form
Set frm = Forms!SubForm_2
set frm = me.parent.controls!subform2.form

dim ctl as control
set frm = me.parent
for each ctl in frm
     if ctl.Name = "SubForm2" then
        exit for
     end if
next

set frm = ctl.Form

Not a single one works, i am constantly getting a run-time error 2455, saying, "You entered an expression that has an invalid reference to the property Form/Report" or something to that degree. Is there no way that I can control effects that happen in one subform from another subform?
thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 
I am not sure I understand what you are trying to do but once I wanted to access a subform and i did using the following statement:

Forms!MainForm.Subform1!ControlName

Hope it helps!
 
What am i trying to do...hrm..

Okay,

MainForm -> ControlSource = Query 1
SubForm1 -> ControlSource = Query 2
SubForm1_1 -> ControlSource = Query 4
SubForm2 -> ControlSource = Query 3

Information found in the current Record of Query 1 filters Query 2 & Query 3.
Information found in the current Record of Query 2 filters Query 3 & Query 4

When I change the current record in the main form the following happens:
- Update Filter for SubForm1
-SubForm1 subsequently updates its own SubForm1_1
- Update Filter for SubForm2 based on CurrentRecord and Control in SubForm2

When I change the Filter control in SubForm1:
- Update SubForm1_1 Filter
----->Update MainForm.SubForm2 Filter from SubForm1.

Many of these things are things that I would be perfectly capable of doing through Delphi or C++, using back end stuff, but I figured there should be a way of doing this level of manipulation directly within Access.

Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 
Depending on which version of Access you are using, subforms CANNOT be filtered. Modify their queries to reference the form field you want to filter on and then requery the subform when that field is modified.

Where fldA = Forms!frmParent!someField AND fldB = Forms!frmparent!frmsub1.Form!someField

Notice the slight change in syntax when referencing a control on a subform.
 

Users who are viewing this thread

Back
Top Bottom