Aiysha
asked on
population combo with database values.
HOw can I populate a combobox in vb with data from a field in a database. The query I want to use is "Select distinct("Field1") from dbTable"
I want to know how to open the database and get the data into combo.
Thank you.
I want to know how to open the database and get the data into combo.
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cbo1.additem "whatever" is the correct syntax
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The following worked perfect. I still appreciate your input.
Dim conn
Dim rec
Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OL
esql = "select Distinct STATE from Dataset"
rec.Open (esql), conn, adOpenStatic, adLockReadOnly
If rec.RecordCount > 0 Then
rec.MoveFirst
Do Until rec.EOF
FacilitySelection.CmbState
rec.MoveNext
Loop
End If
conn.Close
Set conn = Nothing