Conditions

astarbyfar

Registered User.
Local time
Today, 21:27
Joined
Apr 27, 2003
Messages
93
Hi, I have created a Yes/No attribute. Im just wondering if a text boxes visibility can be dependent on the result of this. E.g. If a row is set to yes then the text box will be shown and if it is set to no the text box is made invisible. Thanks for any help
 
Sure,
You can use conditional formating not to mess with vba.
 
Can you use conditional formatting to alter visibility? I didn't know that. How? I can't find the visibility thing in the conditional formatting dialouge.
 
Code:
If Me.FieldName = True Then
Me.TextboxName.Visible = True
Else
Me.TextboxName.Visible = False
End If

Replace FieldName and TextBoxName with the names of your Yes/No Field and your textbox name respectively.
 
Although this is not truly visible/invisible thing :) but ...
You would need to set enabled/disabled property in conditional formating dialogue and pick up the color of your fonts,textbox background to match the background colour of your form.
See example
 

Attachments

  • untitled1.jpg
    untitled1.jpg
    61.8 KB · Views: 122
Help

Sorry about this people but i have another problem. What i want to do is set the visibility of a text box on the value stored in a drop down menu. E.g. I want the system to display a text box when the value in the drop down menu selected is 'idle'. Any help would be much appreciated. Mike
 
The code below uses txtbox as the name of the text box the user enters the Idle value, and HideTxtbox as the name of the text box to be hidden. Note that I set an else statement, this is used to ensure that if the user entered Idle on the text box and the field is was hidden that it displays back, otherwise once it is hidden it remains hidden regardless of what values are entered on the text box. The user only has to enter Idle 1 time to make the button hide, after that the button is hidden until something else makes it visible, the ELSE statement prevents this from happening.

Sub txtbox_AfterUpdate()
If me.txtbox.value = "Idle" Then
me.HideTxtbox.visible = False
Else
me.HideTxtbox.Visible = True
End If
End Sub
 
How can this be done in continous forms? If I have a control and want to set it to visible for some records and invisible for others, depending on a value in a field... is that possible?
 

Users who are viewing this thread

Back
Top Bottom