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

Display all records in a combo box

Status
Not open for further replies.

bigleroy

Programmer
Mar 1, 2002
7
US
I am using a bound combo box to display records. However, only the first record of the recordset is being displayed. How do I display all records?



Set cnnProvType = New ADODB.Connection
cnnProvType.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CustSvc;Data Source=POKEMON"
cnnProvType.Open

Set recProvType = New ADODB.Recordset
recProvType.Open "SELECT DISTINCT VendorType FROM VendorType " _
& "ORDER BY VendorType", cnnProvType, adOpenStatic, _
adLockOptimistic, adCmdText

Set dbcProviderType.DataSource = recProvType
Set dbcProviderType.RowSource = recProvType
dbcProviderType.DataField = "VendorType"
dbcProviderType.ListField = "VendorType"
dbcProviderType.BoundColumn = "VendorType"

Thanks,
Leroy
 
Try this and let me know if it work.

With recProvType
.MoveFirst
Do until .EOF
Combo1.AddItem !FieldName
.MoveNext
Loop
End with

 
Kendel,

The type of combo box I was using (OLE DB DataCombo Box) does not have the AddItem Method. I switched to a normal combobox and now it works correctly.

Thanks,
Leroy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top