Reference Subform in Main Form

D

Debbie

I am trying to reference a field in a subform in the Main
form in a formula. I'm using...

=[Forms]![frmMain]![Subformtitle].[fieldinsubform]

I know this can't be correct because it's not working. In
fact, the formula I'm trying to use is...

=iif(([Forms]![frmMain]![Subformtitle].[fieldinsubform]
=__, "yes", "no")

I would even go so far as to say that I would like a tab
to enable visible if this subform field is "yes".

Please help.

Thanks.
 
G

GVaught

The textbox on your main form should have this statement in the Control
Source section:

=IIF[Forms]![frmCustomers]![sfrmEmployees]![Firstname]= "Chuck", "yes",
"no")
Qualifier ! name of main form ! name of subform ! name of field on subform
= Criteria value, return value.

Is that your format?
Your criteria needs to be static. What is ___? Is this text, a number or are
you physically looking for an underline type symbol?
 
J

JR

Hi Deb,

The answer you posted still doesn't look right somehow. The correct
reference to a sfrm control is (assuming your main form has the focus):

me.sfrmName.form.sfrmControlName

The subform itself is held in a "container". Access gives this container
the same name as the actual subform when you insert it, which can get a bit
confusing. I tend to add "Control" to the end of the the container name
just to distinguish it from the subform.

--

Jamie :blush:)


Nevermind... Someone in Forms helped. The answer is...
=[Forms]![frmMain].[Subformtitle]![fieldinsubform]

I had my "!" and my "." switched.

Thanks All.
-----Original Message-----
I am trying to reference a field in a subform in the Main
form in a formula. I'm using...

=[Forms]![frmMain]![Subformtitle].[fieldinsubform]

I know this can't be correct because it's not working. In
fact, the formula I'm trying to use is...

=iif(([Forms]![frmMain]![Subformtitle].[fieldinsubform]
=__, "yes", "no")

I would even go so far as to say that I would like a tab
to enable visible if this subform field is "yes".

Please help.

Thanks.


.
 
D

Debbie

You are correct. That was my format, but I found that I
was suppose to put a "." in between the fields like:

=IIF[Forms]![frmCustomers].[sfrmEmployees]![Firstname]
= "Chuck", "yes","no")

Thanks... debbie =}
-----Original Message-----
The textbox on your main form should have this statement in the Control
Source section:

=IIF[Forms]![frmCustomers]![sfrmEmployees]![Firstname] = "Chuck", "yes",
"no")
Qualifier ! name of main form ! name of subform ! name of field on subform
= Criteria value, return value.

Is that your format?
Your criteria needs to be static. What is ___? Is this text, a number or are
you physically looking for an underline type symbol?

Debbie said:
I am trying to reference a field in a subform in the Main
form in a formula. I'm using...

=[Forms]![frmMain]![Subformtitle].[fieldinsubform]

I know this can't be correct because it's not working. In
fact, the formula I'm trying to use is...

=iif(([Forms]![frmMain]![Subformtitle].[fieldinsubform]
=__, "yes", "no")

I would even go so far as to say that I would like a tab
to enable visible if this subform field is "yes".

Please help.

Thanks.


.
 

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