By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Yes/No Check Box

P: n/a
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.

I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?

Oct 24 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
You should be able to set the subform's source object based on value of the
checkbox control.

"JayDawg" <he******@cox.netwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.

I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?

Oct 24 '06 #2

P: n/a

JayDawg wrote:
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.

I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?
here's an example.

Private Sub cmdToggleSubformVisible_Click()
Me![Applications].Form.Visible = Not Me![Applications].Form.Visible
End Sub

Applications is the *Sub*form name.
Me is the mainform (since the checkbox is on it already)
If the subform isn't visible, you can't tab to it. (I don't think you
can anyway...) so you would go to the visible subform.

Oct 24 '06 #3

P: n/a
Not sure I understand completely what you mean, i know how to connect a
form and subform through the parent child relationship, but dont know
how to tell it to open or make visible a subform based upon the value
in the parent form.

Wes Peters wrote:
You should be able to set the subform's source object based on value of the
checkbox control.

"JayDawg" <he******@cox.netwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.

I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?
Oct 24 '06 #4

P: n/a
Add some code to the main form's "Current" event and the checkbox's "After
Update" event that sets the subform's SourceObject property:

If checkbox = 0 then Me.subform.SourceObject = "thisform" Else
Me.subform.SourceObject = "thatform"

or something like that.

If the link fields are the same for both subforms then that should be all,
otherwise you'll need to set those properties too.

"JayDawg" <he******@cox.netwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Not sure I understand completely what you mean, i know how to connect a
form and subform through the parent child relationship, but dont know
how to tell it to open or make visible a subform based upon the value
in the parent form.

Wes Peters wrote:
You should be able to set the subform's source object based on value of
the
checkbox control.

"JayDawg" <he******@cox.netwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.
>
I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend
upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?
>

Oct 24 '06 #5

P: n/a
I appreciate your assistance and I am sure you are pointing me in the
right direction, but this didnt work for me, probably because I did
something wrong. I dont know VBA real well, can you send me a little
more step by step directions as to what I am suppossed to do. Where do
I put the code on the details section of the form?

pi********@hotmail.com wrote:
JayDawg wrote:
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.

I have a data entry form that collects data on our opened or closed
positions available for physicians. So depending upon what the answer
is with regard to whether a position is open or closed will depend upon
what other table/form I need to fill out, so how do I tell access to
direct itself to a connected table/form when I select yes or no on the
main/original form?

here's an example.

Private Sub cmdToggleSubformVisible_Click()
Me![Applications].Form.Visible = Not Me![Applications].Form.Visible
End Sub

Applications is the *Sub*form name.
Me is the mainform (since the checkbox is on it already)
If the subform isn't visible, you can't tab to it. (I don't think you
can anyway...) so you would go to the visible subform.
Oct 24 '06 #6

P: n/a

JayDawg wrote:
I appreciate your assistance and I am sure you are pointing me in the
right direction, but this didnt work for me, probably because I did
something wrong. I dont know VBA real well, can you send me a little
more step by step directions as to what I am suppossed to do. Where do
I put the code on the details section of the form?
Try this one...

Private Sub chkShowSubform_Click()
Me![SuppliesNeed].Form.Visible = Me.chkShowSubform
End Sub

I have the checkbox "chkShowSubform" on my main form.
The subform is called "SuppliesNeed".
"Me" refers to the form the checkbox is on. (the main form)

So, the ShowSubform stuff is...
MainformName![SubformName].Form
Visible is a property of the subform.
I'm just setting the value of it to the value of the checkbox on the
main form, (in VB shorthand, "Me")

If you want the visible property of the subform to change depending on
the value of the current record, you have to force the Visible property
to be reevaluated in the Current event of the form.

So in the Current event of the Main form, put this code:

Me![SuppliesNeed].Form.Visible = Me.chkShowSubform

(yes, it's the same code as for the checkbox.)

test it out... does it work now?

Oct 24 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.