Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set visible property based on check box on subform 1

Status
Not open for further replies.

mongous

Technical User
Jun 18, 2002
116
US
I have a tabbed form with a subform on the second tab. I have a label on the first tab (main form) with visible set to false.

I want it to show ONLY IF the checkbox on the subform is checked, which will change with each record.

I am not sure WHERE to put the code. Form_load? Form_Current? Here is what I was thinking:

Code:
Private Sub Form_Load()
    If Me!sfrAppData.Form!DoNotInterview.Checked = True Then
    Me!lblIneligible.Visible = True
    Else: Me!lblIneligible.Visible = False
    End If
End Sub

As you can tell, I haven't quite figured out how to properly reference the controls either....

Any help would be appreciated!
 
Hi!

Try this:

Private Sub Form_Current()
Me!lblIneligible.Visible = Me!sfrAppData.Form!DoNotInterview.Checked
End Sub

hth


Jeff Bridgham
bridgham@purdue.edu
 
It states it can't find the field 'sfrAppData' referred to in your expression.(?)
 
I would try something like this:
Me!lblIneligible.Visible = Me![NameOfTabControl].Pages("NameOfTab")![NameOfsfrAppDataControl].Form!DoNotInterview.Checked
End Sub


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Object doesn't support this property or method.

Here's how it looks:
Code:
Private Sub Form_Current()
Me!lblIneligible.Visible = Me![TabCtl0].Pages("Application Info")![DoNotInterview].Form!DoNotInterview.Checked
End Sub
 
Hi!

Here is the general syntax:

Me!NameOfSubformControl.Form!NameOfControlOnSubform

Since you want the lable to show when the box is checked you can use this code, in general form:

Private Sub Form_Current()

Me!NameOfYourLabel.Visible = Me!NameOfYourSubFormControl.Form!NameOfYourCheckBoxOnYourSubForm.Value

Please note that we are using the current event here so the label will change with the record. Also note that it should not matter that the subform is on a tab, this should still work.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Ok thanks. It will be Friday before I can wrok on it again, but I will give it a try and post back.

Thanks again for your help!
 
Ok, I still get the msg: 'Can't find the field sfrAppData as referred to in your expression'


Here's the code:
Code:
Me!lblIneligible.Visible = Me!sfrAppData.Form!DoNotInterview.Value
 
Hi!

Maybe you can zip and email the Db to me.



Jeff Bridgham
bridgham@purdue.edu
 
What is sfrAppData ? I guess the subform name.
You should replace it with the name of the control hosting it.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PHV!

That was the problem. All of my posts said to use the NameOfYourSubformControl but I suspected that sfrAppData was a form like you did. That is why I had the database emailed to me so I could look at all of the names.



Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top