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

Combobox selection to move to database Record/fields

Status
Not open for further replies.

data59

MIS
Jun 30, 2005
17
0
0
US
I have a ComboBox, (unbound) that has several items listed, My form is linked to a Access Database. If the combobox matches an entry in a field(ID) in my combobox, I want to be able to move to that record in my database and display the other fields information in textboxes. Easy to do in Access but I can’t figure it out in VB6
 
Something like this should do it. I use something like it to query a table based on the field that is selected in the combo.

Code:
combobox.additem "sales person",0
combobox.additem "Customer Name",1
on the search button
add this code
select case combo1.listindex
case 0
rs.Open "Select * from INVTB1 WHERE SP='ANUP' Order By CN", db, adOpenDynamic, adLockOptimistic
case 1
rs.Open "Select * from INVTB1 where CN like '" & Text35 & "%'", db
end select

-David
2006 Microsoft Valueable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top