Using Access 2007 I have setup nested forms.
Master Form is frmOrder which has a subform frmCut which has a subofrm
frmRoll.
On frmCut i have a control named BiasSize
On frmRoll I want to refer to the control BiasSize on frmCut
I have the following code in the AfterUpdate event of another control
on frmRoll:
Private Sub cmdActualYardsEntered_AfterUpdate()
Dim intBiasSize As Single
Dim BiasMultiplier As Single
intBiasSize = Forms![frmCut]!BiasSize ' Error occurs here
If intBiasSize > 0 Then
If intBiasSize = 1.5 Then BiasMultiplier = 43
If intBiasSize = 3 Then BiasMultiplier = 20
Me![cmdActualyd] = Me![cmdActualYardsEntered] * BiasMultiplier
Else
Me![cmdActualyd] = ([cmdInchesOnSpread] + [InchesOfWaste]) /
36
End If
End Sub
I am getting an error: Run-time error '2450': Microsoft Office Access
can't find the form 'frmCut' referred to in a macro expression or
Visual Basic code.
frmCut is the correct name of the form.
I am a newbie and kind of jumped into VBA without some of the
underlying knowledge of how to refer to different objects. So please
forgive me if this is a simple question.
Brent
Maurice - 05 Feb 2008 15:35 GMT
Try:
intBiasSize = me.parent!BiasSize
see if that works

Signature
Maurice Ausum
> Using Access 2007 I have setup nested forms.
>
[quoted text clipped - 36 lines]
>
> Brent
unclemuffin - 05 Feb 2008 17:08 GMT
I solved my own problem.
I was attempting to refer to the name of the form instead of the
actual subform control name.
I used the following to get it to work:
intBiasSize = Forms![frmOrder]![subfrmCut]!BiasSize
where subfrmCut is the name of the subform in frmOrder
> Try:
>
[quoted text clipped - 44 lines]
>
> > Brent