listbox multi-queries

kingsgambit

Registered User.
Local time
Today, 11:29
Joined
May 27, 2001
Messages
134
Part of my database that I am building has a section for contacts, on a search form I have a list box where is attached to a query, the listbox shows Firstname,Lastname,Telno. As there will be over hundred contacts in the database I want to be able to have buttons on the form where the user can chooses letters to search will i.e ABC,DEF this will brake down the list.
Ihave made the queries with Like "a*" and they work. How can I get the results from whatever the user clicks on to appear in the same listbox. i.e Whatever button pressed would be the rowsource
 
Create the query with "Like a* OR Like b* etc.. then look at the SQL statement of the query. Copy that and place that in the following code:

Dim MyStr As String
MyStr = "SELECT Firstname,lastname,telno, FROM MyTable WHERE lastname Like 'g*' OR lastname Like 'h*';"
Me.lstBox.RowSource = MyStr
Me.lstBox.Requery

Place this code on the OnClick event of the button.

HTH
 
Thanks alot that worked
 

Users who are viewing this thread

Back
Top Bottom