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

using multi list box as basis of query

Status
Not open for further replies.

tizwaz

Technical User
Joined
Aug 8, 2002
Messages
437
Location
GB
I have a multi select list box which lists all the names from my table. The list shows a list of full names based on a query which concanatates the first name and surname and removes any duplicate names by selecting only distinct records.

I am trying to create SQL to base my query on based on the selections in the list box. I've found some useful tips on here and created a hidden text box to hold the SQL. However as I have only selected distinct records for my list box using the IssueID for the SQL will only return the records shown in the list box.

My table holds a lot of historic data which was imported from another database and I need to return all records for a particular person. However the person's name was not always entered in the same way eg Joseph Smith and then Joe Smith the next time. Hence the multi select list box. However Joseph Smith may have been entered several times and I need all records for him. Is the only answer to allow all records to go in the list box and then the user would have to click on all instances of Joseph Smith for eg. Is there a better way i can do this? I really need to have SQL which says First Name = and Surname = but can''t see how to do this
 
How are ya tizwaz . . .

Include the first name and surname columns in the listbox and use those in the criteria of the SQL. Assuming first name is column3 and surname is column 4, the criteria would look like:
Code:
[blue]"WHERE ([First Name] = '" & Me!ComboboxName.Column(3) & "' AND [SurName] = '" & Me!ComboboxName.Column(4) & "');"[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top