Referring to Subform

G

Guest

Hi,
I have
MainForm SubForm1 SubForm2
I have the following code to change the AllowAdditions property to False on
SubForm2 based on the value of the chkBox in SubForm2. The code is on the
On Load event of the MainForm

If Forms![MainForm]![SubForm1]![chkBox].Value = True Then
Forms![MainForm]![SubForm1]![Subform2].Form.AllowAdditions = False
End If

The Error Message I "usually" receive is that the databaseName cannot find
the FIELD "SubForm2". I checked the code in a book and in fact, that is the
way to reference a FIELD. However, I can't find anything on how to reference
the Property of SubForm2 from MainForm. I have tried it several different
ways with dots, parenthsis, brackets and bangs.

I don't know what I am missing.
As always - I appreciate the help and this discussion group.
Captain OhNo
 
G

Guest

Correction: I want to change the AllowAdditions property to False on
Subform2 based on the value of the chkbox in SubForm1. Sorry Capt OhNo
 
R

RuralGuy

CaptainOhNo wrote...
Correction: I want to change the AllowAdditions property to False on
Subform2 based on the value of the chkbox in SubForm1. Sorry Capt OhNo

Captain OhNo said:
Hi,
I have
MainForm SubForm1 SubForm2
I have the following code to change the AllowAdditions property to False on
SubForm2 based on the value of the chkBox in SubForm2. The code is on the
On Load event of the MainForm

If Forms![MainForm]![SubForm1]![chkBox].Value = True Then
Forms![MainForm]![SubForm1]![Subform2].Form.AllowAdditions = False
End If

The Error Message I "usually" receive is that the databaseName cannot find
the FIELD "SubForm2". I checked the code in a book and in fact, that is the
way to reference a FIELD. However, I can't find anything on how to reference
the Property of SubForm2 from MainForm. I have tried it several different
ways with dots, parenthsis, brackets and bangs.

I don't know what I am missing.
As always - I appreciate the help and this discussion group.
Captain OhNo

I think you are just missing one little "Form" in the right place.

Forms![MainForm]![SubForm1].Form![Subform2].Form.AllowAdditions = False
 
G

Guest

AAAHHHH! Thanks RuralGuy - I see your name alot in these posts. Thanks for
the help!
Capt OhNo

RuralGuy said:
CaptainOhNo wrote...
Correction: I want to change the AllowAdditions property to False on
Subform2 based on the value of the chkbox in SubForm1. Sorry Capt OhNo

Captain OhNo said:
Hi,
I have
MainForm SubForm1 SubForm2
I have the following code to change the AllowAdditions property to False on
SubForm2 based on the value of the chkBox in SubForm2. The code is on the
On Load event of the MainForm

If Forms![MainForm]![SubForm1]![chkBox].Value = True Then
Forms![MainForm]![SubForm1]![Subform2].Form.AllowAdditions = False
End If

The Error Message I "usually" receive is that the databaseName cannot find
the FIELD "SubForm2". I checked the code in a book and in fact, that is the
way to reference a FIELD. However, I can't find anything on how to reference
the Property of SubForm2 from MainForm. I have tried it several different
ways with dots, parenthsis, brackets and bangs.

I don't know what I am missing.
As always - I appreciate the help and this discussion group.
Captain OhNo

I think you are just missing one little "Form" in the right place.

Forms![MainForm]![SubForm1].Form![Subform2].Form.AllowAdditions = False
 
R

RuralGuy

(e-mail address removed) wrote...
AAAHHHH! Thanks RuralGuy - I see your name alot in these posts. Thanks for
the help!
Capt OhNo

You're welcome and thanks for posting back with your success.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top