|
-
Jan 20th, 2005, 02:45 PM
#1
Thread Starter
Addicted Member
DB lookup using a combo box
I saw an app thats in use her in my office that uses some sort of Combo box to look records in a DB then display the record in the appropriate controls.
Now... the db has 1 field for the Last name, and 1 field for the First name...
However the combo box combines the two fields like Last Name, First Name and displays them in the drop down.
Any ideas how to accomplish that?
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Jan 20th, 2005, 02:47 PM
#2
Re: DB lookup using a combo box
VB Code:
Combo1.Additem FirstName & " " & LastName
-
Jan 20th, 2005, 05:12 PM
#3
Re: DB lookup using a combo box
You would first have get all records you need from table using perhaps ADO Recordset, Connection objects. To get records you'll also need some SQL statement like:
Select * From Employee Where Dpt = 'IT'
You'll then loop through your recordset and add <LastName & " " & FirstName> to your combobox just like Hack demonstrated.
After that you have two choices: either populate some UDT with the rest of info but simultaniously with combobox so indexing will be in-sync OR you'll have search recordset every time.
If you use array of UDT then upon secting new name from combo - you'll get rest of info from your UDT and populate your textboxes.
If you have any problem with implementing all of the above - give me a buzz.
Good luck.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|