text box only visible when yes/no field checked

ianking

Registered User.
Local time
Today, 08:19
Joined
Mar 15, 2008
Messages
29
Is it possible to make a text box displaying a text field on a form only visible when a yes/no field is checked?

I have tried setting it a not visible and using textbox.visible=true when the yes/no field is updated, but this makes it visible for every record, not just the one where yes/no is true.

Thanks,

Ian
 
Use this in the Checkbox's After Update event and also on the form's On Current event:

Me.YourTextBox.Visible = Me.YourCheckboxNameHere
 
thanks

Thanks again Bob - instant service!
 
I'll start by saying i have zero experience with macros but, have the same exact quesiton as the above individual, however, i have placed the code as specified (with my fields replaced) in the on current procedure as well as the after update procedure of the respective items..

however, when i try to run the form i get the error that access cannot find the macro "Me." Clearly i'm missing a step to create this group or something of that nature... is there way to walk me step by step through the process?

Much thanks
 
You need to post your code for us to decipher what is wrong. Include all the code for the event.
 
Hi - thats the problem, im not sure what code to write - all i have entered is this

Use this in the Checkbox's After Update event and also on the form's On Current event:

Me.YourTextBox.Visible = Me.YourCheckboxNameHere

(clearly updating for my field names - as a side note, can field names have spaces or should i fill them in with _ ) as i have

thanks
 
Wow - that was easy... thanks so much! you guys are quick

I'm sure i'll be back with more questions but that really helped alot...
 
I'll explain this project to see if someoen knows a better way to do this since im getting an "invalid use of null" error..

We have a field (stat audit yes no), that when clicked needs to make the other fields appear. The code below does that well. However what we are attempting to do is create a database that keeps the history..

for example, on 1/1/10 the requirements are X
on 2/1/10 the requirements are y

What i have done to do this is use the "duplicate record" to create a new record and then we will edit the changes on the new record (so as to maintain the history of past relationships etc) However, when i click duplicate reocrd i get the invalid use of null error (though it still duplicates the record for some reason?) Any way to avoid this

The form works well with no errors wihout this code added (but does not have the show hide function of the y/n button) Perhaps i have something wrong in my code?

Option Compare Database
Private Sub Form_Current()
Me.FS_Type_1.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_1.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_1.Visible = Me.Stat_Audit_Yes_No
Me.FS_Type_2.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_2.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_2.Visible = Me.Stat_Audit_Yes_No
Me.FS_Type_3.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_3.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_3.Visible = Me.Stat_Audit_Yes_No
End Sub
Private Sub Stat_Audit_Yes_No_AfterUpdate()
Me.FS_Type_1.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_1.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_1.Visible = Me.Stat_Audit_Yes_No
Me.FS_Type_2.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_2.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_2.Visible = Me.Stat_Audit_Yes_No
Me.FS_Type_3.Visible = Me.Stat_Audit_Yes_No
Me.Service_Provider_3.Visible = Me.Stat_Audit_Yes_No
Me.Stat_Date_3.Visible = Me.Stat_Audit_Yes_No
End Sub

Thanks
 
Last edited:
I will definitely try this.. acutally, I recall coming across a code that made a button click that automatically duplicated the record and saved changes to it as well..?

On a side note, the next step of the project is to have forms pop up, or tabs or something to fill out when a certain button is checked (so that's easy enough, i think per our previous discussion and the forums here). However, my problem here lies not so much in the construction but the organization of the DB.

The database is designed as follows and i have attached a screen shot of the main page...

The Stat audit Y/N check box makes the fields on the right pop up with all the audit requiements (thats what we had worked on), though still get that invalid use of null (ill try your suggestion)

The next issue is the "tracking interests" section of the form.

As you see below there is a checkbox next to each parent company. What i need to have happen is when i click lets say parent 1's tracking interest box, another form/tab/something, pops up that makes the user fill in data on that relationship.

The relationship is defined as the parent's other interest (besides the % listed) in the "entity" in other words, Entity 1's interest in Entity 6 (i have this form made just need to figure out how to organize it)

When the record is duplicated, i would need both the record itself, as well as the sub forms for example Entity 1's interst in 6 entity 2 in 6 and 3 in 6 etc (if checked)... so not sure the proper organization..

not sure if i'm explaining this all well, but i figured if anyone knows this stuff its you guys. Thanks again!

10hsjmr.jpg
 
Per another post i went in to all my Y/N fields and changed their default value's to NO... that seemd to do the trick..

if you have any comments about my other issue please let me know

Thanks so much for your help
 
Last edited:

Users who are viewing this thread

Back
Top Bottom