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!

How to populate a combo box based upon a datacombo?

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
0
0
I am designing a form with a datacombo control and a regular combo box. What I need to do is to populate a list in the combo based on the selection of the datacombo. How to do this, any examples?

Thanks

Haijun
 


Set db = Opendatadase("Your Database")
Set rs = db.OpenRecordset("Select * From TableName Where
Field1='" & Datacombo.text & "'")


With rs
combobox.clear
Do
combobox.AddItem !Field2
.movenext
Loop Until .EOF
End with

rs.Close
Set rs = Nothing
[thumbsup]
 
Do I need to use connection object to connect database?

Haijun
 
Do I need to use connection object to connect database? If I use datacombo, How can I do it?

Haijun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top