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!

Listbox question

Status
Not open for further replies.

kpereira

Programmer
Jun 29, 2000
33
0
0
US
Hello Everyone!

I was hoping that someone might have the answer to a question. I have a search form with a listbox, a text field, a combo box and a button. Usage:
1. Select a value in the combo box, e.g. First Name, Last Name, ID.

2. Next, there is a text box to enter the search criteria, "Smith" let's say for last name.

3. Next, click the find button.

The purpose here it for the appropriate row of the listbox to be selected based on the criteria and combobox selection. For example, if the user chooses Last Name, then enters "Smith" the first occurrence of "Smith" as the last name in the lisbox should be selected.

I am lost...brain cramp...HELP!

Thanks in advance,

Karen
 
Hey there if you set the button to
on click
NameOfListBox.requery

Then in the List properties click on the row source field so that it goes into SQL. Looks the same as creating a query.
Presuming that you have 3 different combo boxes one for Title, FIrst name , last name. You need to assign the fields to their corresponding combo boxes. In criteria enter
IIF(ISNull([Forms]![form name]![combo box name]),[field name],[Forms]![form name![combo box name])
This will set the list box to show all the not null records in the list box enless you specify which ones you want to change it to.
This will work with combo boxes but when you get into list boxes thing become a little bit more tricky. There you have to use a like statement.
Have actually been designing something similar for a bussiness in the city if you want a copy of the form then I can send it you. Only thing is that it will not have the table but you can use it for referecne. Or you can go to the Microsoft site (support.microsoft.com) and run a search in Access for Criteria.
See ya
Herbe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top