A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how do i open a subform based on a yes entry in a field in main fo



 
 
Thread Tools Display Modes
  #1  
Old October 2nd, 2009, 11:07 AM posted to microsoft.public.access.forms
banbloom
external usenet poster
 
Posts: 1
Default how do i open a subform based on a yes entry in a field in main fo

I am a new user. I have a yes/no field in a main form/table and I want a
subform to open if 'yes' is clicked on the mainform. Can someone help?
  #2  
Old October 2nd, 2009, 03:16 PM posted to microsoft.public.access.forms
Golfinray
external usenet poster
 
Posts: 1,597
Default how do i open a subform based on a yes entry in a field in main fo

You would need to go into the properties of the checkbox, go to events, go to
the onclick event, click the little button out to the right and start the
code builder. When the code builder comes up, you would need to type
Docmd.openform, "yourformname" and then follow the options.
--
Milton Purdy
ACCESS
State of Arkansas


"banbloom" wrote:

I am a new user. I have a yes/no field in a main form/table and I want a
subform to open if 'yes' is clicked on the mainform. Can someone help?

  #3  
Old October 2nd, 2009, 03:30 PM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default how do i open a subform based on a yes entry in a field in main fo

banbloom,
Let's say the checkbox control on your form is named... chkOne, and it
is a boolean field, as you say.
And, your subform name is... frmCheckOneSub

If you use the form Open command, the subform will open in it's own
window, which is not what you want. We'll use the Visible = True/False
property
instead. Make the subform Visible property = to False as the design
default.

In design mode, and viewing the Properties dialog box, and having chkOne
selected...
Locate the AfterUpdate event for chkOne.
Place your cursor in the blank text control.
Using the little arrow on the right, select Event Procedure from
the drop down.
Click the little button on the right with 3 dots (...)
You are now in the form's Module, where VB code can be placed.
You'll see this...

Private Sub chkOne_AfterUpdate()

End Sub

Enter this text between the 2 lines...

Private Sub chkOne_AfterUpdate()
If Check1 = True Then
frmCheckOneSub.Visible = True
Else
frmCheckOneSub.Visible = False
End If
End Sub

*** OR ***

Private Sub chkOne_AfterUpdate()
frmCheckOneSub.Visible = chkOne = True
End Sub

Either coding will show/hide the subform accordingly.

-- hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"banbloom" wrote in message
...
I am a new user. I have a yes/no field in a main form/table and I want a
subform to open if 'yes' is clicked on the mainform. Can someone help?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.