Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field to display only when another value is selected

Status
Not open for further replies.

scsuflyboy72

Technical User
Jan 30, 2008
13
US
I have two controls on my form, InternetWO? and IWO.

InternetWO? has a default value of NO

If this value is changed by the user to YES, I want the IWO to be visible, otherwise it is not.

How do i do this?
 
Set the Visible property for IWO as false since the default is for it not to show.

then I would try setting the AfterUpdate event of the first field to:

If me!InternetWO? = "YES" then
me!IWO.Visible = True
else
me!IWO.Visible = False
end if



Sandy
 
How do you want them to be able to do it, click a button, click a bubble?

In what ever event you choose

And you did not say what type of control it is but something like

InternetWO?.visible = Not InternetWO?.visible
 
InternetWO is a dropdown box. If Yes selected, then I want IWO to be visible, otherwise visible=No
 
I was just relating an idea on how to get it to do what you wanted - should have been clear about that, sorry. Maybe if you let us know what type of control's you're using we can come up with some code for you to copy with little or no modification.

Sandy
 
Since your default value for InternetWO is No, then your visible property for IWO should be set False. Once InternetWO is set to Yes, the following should execute

Code:
Private Sub InternetWO_AfterUpdate()
    If InternetWO = "Yes" Then
        IWO.Visible = True
    Else
        IWO.Visible = False
    End If
End Sub

Sandy
 
InternetWO is a Text box, dropdown actually with Yes and No as the drop down options.

IWO is just a text box.

Do you need more info because I am unsure what else you may need.
 
OK, I don't know if this is an issue but I am using Access 2003.

I assume No=False (2003 Visible options are Yes and No, not true and false)

Second, if the version is not an issue, then something else isn't right because placing that code in the AfterUpdate event of InternetWO does nothing.
 
How are ya scsuflyboy72 . . .

[ol][li]In design view,set the [blue]Visible[/blue] property of [blue]IWO[/blue] to [purple]No[/purple].[/li]
[li]In the [blue]AfterUpdate[/blue] event of [blue]InternetWO[/blue], copy/paste the following:
Code:
[blue]   Me!IWO.Visible = (Me!InternetWO.Column([purple][b]X[/b][/purple]) = "Yes")[/blue]
Where [purple]X[/purple] is the column index (starts at zero), and includes columns hidden in the [blue]Column Widths[/blue] property . . .[/li][/ol]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Almost there...

When the form is opened the first time, IWO is not visible, InternetWO is displaying the default value of "No". When Yes is selected the IWO box displays.

Here lies the problem:

When the * is pushed (to enter a new record) the IWO text box remains visible although the new default value of internetWO is "NO".

Is there a way to make it where the text box goes back to the default of not visible without closing the form?
 
Set the IWO.Visible property in the Current event procedure of the form too.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I actually have a couple of issues:

Is there a way to keep the records with "Yes" and IWO visible to display at all times?

Right now, If yes is selected, the IWO box becomes visible.

However, when a new record is added the box is still visible although InternetWO is NO.

Also, when I open the form again, I would like those records that have Yes and IWO visible to remain visible,
 
scsuflyboy72 . . .

Arwe you talking the forms [blue]new record navigation button [/blue]
AddNewButton.BMP
or a [blue]*[/blue] included in the [blue]InternetWO[/blue] combobox?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks PHV, that works great...

Thanks for the help everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top