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  

Making Subform Visible On One record Only



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2010, 08:23 PM posted to microsoft.public.access.forms
Brian
external usenet poster
 
Posts: 1,396
Default Making Subform Visible On One record Only

I have an invoice form with a check box which when =True executes a macro to
make a subform visible for additional entries.
Although the macro works, when run, it displays the subform on ALL records
even those records where the check box remains =False.
I only want the subform visble on Check Box=True records.
The check Box is a bound Control in the underlying table.
I've tried various solutions but not got it working yet.

Gordon
  #2  
Old March 17th, 2010, 09:44 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Making Subform Visible On One record Only

On Wed, 17 Mar 2010 13:23:01 -0700, Brian
wrote:

You can use this one-liner in the Form_Current event:
Me.mySubformControl.Visible = Me.myCheckboxField
(of course you replace myObjectNames with yours)

-Tom.
Microsoft Access MVP


I have an invoice form with a check box which when =True executes a macro to
make a subform visible for additional entries.
Although the macro works, when run, it displays the subform on ALL records
even those records where the check box remains =False.
I only want the subform visble on Check Box=True records.
The check Box is a bound Control in the underlying table.
I've tried various solutions but not got it working yet.

Gordon

  #3  
Old March 17th, 2010, 10:21 PM posted to microsoft.public.access.forms
SuzyQ
external usenet poster
 
Posts: 217
Default Making Subform Visible On One record Only

go to the properties for the subform in you main form and set visible to false,

then in the on change event for you check box put the following code

Private Sub checkBoxName_AfterUpdate()
If Me.checkBoxName = True Then
Me.[childFormName].Visible = True
Else
Me.[childFormName].Visible = False
End If
End Sub

I tested this and it does what it seems like you are explaining in your post.

"Brian" wrote:

I have an invoice form with a check box which when =True executes a macro to
make a subform visible for additional entries.
Although the macro works, when run, it displays the subform on ALL records
even those records where the check box remains =False.
I only want the subform visble on Check Box=True records.
The check Box is a bound Control in the underlying table.
I've tried various solutions but not got it working yet.

Gordon

 




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 11:24 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.