I would assume that you want to toggle the visibility of sf_Dependents based on if there are any dependents as you open or move through records on the main form. Try the following. Add breakpoints if it doesn't work as expected so you can step through the code.
The On Current event look something like:
Me.sf_Dependents.Visible = DCount("*","Your Dependents Table Name","LinkingFieldName = " & LinkingFieldFromMain) >0
'Assuming linking field is numeric
If DCount("*","Your Dependents Table Name","LinkingFieldName = " & LinkingFieldFromMain) >0
Your code in the Update of OptAnyDep would be:
Me.sf_Dependents.Visible = Me.OptAnyDep = 1
Duane,
I should have provided that information.
The options box is unbound, but I can change that if you think it is a good
idea.
The name that comes up when I click on the frame is OptAnyDep
The Yes button is called OptionYes , returns a 1
The No button is called OptionNo , returns a 2
I hope I covered what you needed and what you meant by the name of the
options group. Do I have to keep the Frame around the buttons for it to be
a Group?
The subform that contains the information on the dependents is called
sf_Dependents
Bill
Bill Singer
Group Benefits Consultant
Phone: 763-754-8898
Fax: 763-754-8496
Toll Free: 877-902-8898
<mailto:Bill.Singer@at-group.net> Bill.Singer@at-group.net
From: MS_Access_Professionals@yahoogroups.com
<MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, May 8, 2019 7:35 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Visible Property
Hi Bill,
An options group returns a number. Is this bound to a field in the forms
record source? What is the name of the option group? What is the name of the
subform control?
Duane
Get Outlook for iOS <https://aka.ms/o0ukef>
_____
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals@yahoogroups.com>
<MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals@yahoogroups.com> > on behalf of
Bill.Singer@at-group.net <mailto:Bill.Singer@at-group.net>
[MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals@yahoogroups.com> >
Sent: Wednesday, May 8, 2019 4:54:23 PM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals@yahoogroups.com>
Subject: [MS_AccessPros] Visible Property
I have Access 365 and am starting a new project so I think you will be
hearing more of me.
I am creating a health insurance enrollment database..
Here is the first issue.
If a person is single, with no dependents the form is shorter.
If the person has dependents I will need them to fill in the depends
information on a Sub Form. I do not want the sub form to be visible unless
the new employee indicates they have dependent. I am asking the question
on the form and the employee is to respond using an Options box with the
"Yes" or "No" as their choices. If they check no to the question then they
just continue on. If they check Yes, I want the Sub Form to appear.. What
is the best way to change the "Visible" Property of the sub form after the
options box input.
A macro?
Code? A quick sample is always best for me.
Thanks,
Bill
Bill Singer
Minnesota
[Non-text portions of this message have been removed]
------------------------------------
Posted by: "Bill Singer" <bill.singer@at-group.net>
------------------------------------
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)
<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
Tidak ada komentar:
Posting Komentar