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

Hide Particular Values in a Value List 1

Status
Not open for further replies.
Jun 2, 2004
66
0
0
US
Thought this would be an easy one, but I'm having trouble....

I have two unbound txt boxes (txtbox1 and txtbox2) on my form that both contain Value Lists. In both txtboxes, I have the column counts set to 2

Here's what they contain...(dummy entries)
Row Source of txtbox1... 01;"Mike";02;"Tim";03;"Scott"
Row Source of txtbox2... 01;"Name";02;"Address";03;"City"

I am looking for a way to hide particular values from the value list in txtbox2, if certain conditions are met in txtbox1.

In other words, if a user chooses "Mike" in txtbox1, I would like to hide "Address" from txtbox2.

I tried something like this, but had no luck..

Private Sub txtbox1_AfterUpdate()
If txtReportName = "01" Then
Me![txtbox2]???.Visible = -1
End Sub

Is there a way to specify a particular value from the value list in txtbox2 using this logic?

Thanks
 
All you can do is completely reload the list box with new values using the logic you show above.

Alternatively you could have two list boxes, one populated with the long version of the data and one with the short version. Both would be located at the same place on the screen and your logic would simply show/hide the appropriate listbox. You would also need some code to take the data from the visible listbox only.



Bob Boffin
 
Thanks Bob. I'll use your advice and create multiple txt boxes and hide them when certain criteria have been met.


Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top