M
Mr. T.
Hi,
i've got a form that i open in 2 different ways.
One way is to "browse" through the records. Therefore i use the following
code in my main screen:
DoCmd.OpenForm "MyForm", acNormal, , , acFormEdit, acDialog, "BROWSE"
The second way is to go directly to a specific screen. Therefore i made a
search screen (no problem there) and when i want to open the form i use the
following line of code:
DoCmd.OpenForm "MyForm", acNormal, , , acFormEdit, acDialog, Me!MyListBox
when the form opens in the first way (to browse) everything goes fine. But
when i open the form in the second way, i get the error that the expression
contains an illegal reference to the property Form / Subform. I get this on
a line of code in the Form.Current. In that form, depending on the type of
record it is, i want to show or hide some field on a subform. So i added the
following line of code to the Form.Current:
IF MyCriterium THEN
Me.MySubForm.Form!MySubFormField.Visible = True
ELSE
Me.MySubForm.Form!MySubFormField.Visible = False
END IF
That's the line i get the above mentioned error on. Is anyone able to tell
me what i'm doing wrong?
Regards,
Thomas
i've got a form that i open in 2 different ways.
One way is to "browse" through the records. Therefore i use the following
code in my main screen:
DoCmd.OpenForm "MyForm", acNormal, , , acFormEdit, acDialog, "BROWSE"
The second way is to go directly to a specific screen. Therefore i made a
search screen (no problem there) and when i want to open the form i use the
following line of code:
DoCmd.OpenForm "MyForm", acNormal, , , acFormEdit, acDialog, Me!MyListBox
when the form opens in the first way (to browse) everything goes fine. But
when i open the form in the second way, i get the error that the expression
contains an illegal reference to the property Form / Subform. I get this on
a line of code in the Form.Current. In that form, depending on the type of
record it is, i want to show or hide some field on a subform. So i added the
following line of code to the Form.Current:
IF MyCriterium THEN
Me.MySubForm.Form!MySubFormField.Visible = True
ELSE
Me.MySubForm.Form!MySubFormField.Visible = False
END IF
That's the line i get the above mentioned error on. Is anyone able to tell
me what i'm doing wrong?
Regards,
Thomas