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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ListBox to control Visibility of Text Boxes 1

Status
Not open for further replies.

CJP12711

MIS
Jul 23, 2001
116
US
Hello! I have a list box with the values of Yes, No, and Unknown.

If the user selects 'Yes' from the list box, 2 text boxes below should become visible, prompting the user for the date and time. If they choose No or Unknown, the text boxes should remain invisible. I've figured out how to do this based on a check box (using the below code)

Private Sub Check6_Click()
If Check6.Value = True Then
Text2.Visible = True
Text4.Visible = True
Else
Text2.Visible = False
Text4.Visible = False
End If
End Sub

I can't figure out how to do this with a list box. Any help is greatly appreciated!

I'm using Access 2003.

Thanks!
CJ
 
Many ways. Here's one:
SELECT CASE lstListBox.Value
Case "Yes"
Text2.Visible = True
Text4.Visible = True
Case Else
Text2.Visible = False
Text4.Visible = False
END SELECT


"Business conventions are important because they demonstrate how many people a company can operate without."
 
That's what I needed. I didnt' think about using a case statement! Thanks so much!
 
So happy to help!

"Business conventions are important because they demonstrate how many people a company can operate without."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top