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  

Make invisible with a checkbox



 
 
Thread Tools Display Modes
  #1  
Old April 27th, 2010, 10:12 PM posted to microsoft.public.access.forms
Braiock
external usenet poster
 
Posts: 1
Default Make invisible with a checkbox

Hello,

I have a simple form in which I have a checkbox that makes a text field
visible when the checkbox is checked (The text field is not bound). My
problem is that when I switch to the next record the checkbox gets updated
along with the record but the text field does not change along with the
checkbox; if the next record has the checkbox unchecked the text box will
still stay visible.

Here is what code I have:

Private Sub Check19_AfterUpdate()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Private Sub Form_Current()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Thank you for any help you can provide
  #2  
Old April 27th, 2010, 11:06 PM posted to microsoft.public.access.forms
Tore
external usenet poster
 
Posts: 12
Default Make invisible with a checkbox

If your form is a datasheet of continuous form all of the records in your
table will be visible at once. Since the text field is not bound and not
connected to a specific record it will either be visible in all records or
invisible in all records.

If you display your data in a normal form, i.e. one table record at a time,
you can make the text field visible or invisible depending on your checkbox.
For this purpose you make use of the "on current" event. This event fires
every time the user changes from one record to another. In addition to the
code in the "after update" event you should put the same code in the "on
current event".

Regards

"Braiock" wrote:

Hello,

I have a simple form in which I have a checkbox that makes a text field
visible when the checkbox is checked (The text field is not bound). My
problem is that when I switch to the next record the checkbox gets updated
along with the record but the text field does not change along with the
checkbox; if the next record has the checkbox unchecked the text box will
still stay visible.

Here is what code I have:

Private Sub Check19_AfterUpdate()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Private Sub Form_Current()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Thank you for any help you can provide

  #3  
Old April 27th, 2010, 11:13 PM posted to microsoft.public.access.forms
Tore
external usenet poster
 
Posts: 12
Default Make invisible with a checkbox


Sorry, I was too quick
I see you use the on current event already. That should do the trick for
normal forms. For datasheets and continuous forms I dont think it can be done
unless you make the text field bound.

Regards
  #4  
Old April 28th, 2010, 12:36 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Make invisible with a checkbox

On Tue, 27 Apr 2010 14:12:01 -0700, Braiock
wrote:

Hello,

I have a simple form in which I have a checkbox that makes a text field
visible when the checkbox is checked (The text field is not bound). My
problem is that when I switch to the next record the checkbox gets updated
along with the record but the text field does not change along with the
checkbox; if the next record has the checkbox unchecked the text box will
still stay visible.

Here is what code I have:

Private Sub Check19_AfterUpdate()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Private Sub Form_Current()
Me![Text22].Visible = Me!Check19
Me![Attachment29].Visible = Me!Check19
End Sub

Thank you for any help you can provide


For an unbound control on a continuous or datasheet form, there's really only
one textbox, displayed many times; changing its visible property in the
Current event will change all the displayed instances.

What you can do is use the Format... Conditional Formatting feature to set the
foreground color equal to the background color based on the checkbox's value.
--

John W. Vinson [MVP]
 




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 10:21 PM.


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