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

listbox data question 1

Status
Not open for further replies.

ajking

Technical User
Aug 13, 2002
229
I have a textbox (customername) which, in the AfterUpdate event shows a listbox which is populated with any existing customer names in the database (user can either, select from this listbox, or carry on with the data entry.
All this works fine but what I would like to do is to only make the listbox visible when there is a match but if there isn't a match then the listbox stays invisible.
Any help would be much appreciated TIA

'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
In the same AfterUpdate event add ...
cboName.Visible = True (or False)


Randy
 
Sorry, perhaps I didn't make it clear.
I only want to make the listbox visible if the results of the listbox requery returns a value
e.g. If "Bloggs" is entered in the customerName textbox then the resulting requery will return "fred Bloggs widgets" and the Listbox is made visible but, if no data is returned from the requery, then the listbox remains invisible.
how do you test the value of the listbox? I have tried "" and Null but it does not work with those

'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
So there's a query that the listbox is based on.

how about in the AfterUpdate event:

If Dcount("FieldName","QueryName") = 0 then
cboName.visible = False
else
cboName.visible = True
end if


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Many thanks, that pointed me in the right direction

'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top