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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|