looping data from a Recordset into a combo box [Resolved]
I need to do a loop to take all the values in the Supplier column of the db table into the combo box.
I tried doing it myself but somehow or another all I came up with was a record count. lol.
Any help would be greatly appreciated. Thanks =)
VB Code:
Dim sconnect As String
Dim sSQL As String
Dim dfwConn As ADODB.Connection
' set strings
sconnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=M:\supplies\supplies.mdb;Persist Security Info=False"
sSQL = "select Supplier from Products ORDER by Supplier"
' open connection
Set dfwConn = New ADODB.Connection
dfwConn.Open sconnect
' create a recordset using the provided collection
Set datPrimaryRs = New ADODB.Recordset
datPrimaryRs.CursorLocation = adUseClient
datPrimaryRs.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly
Re: looping data from a Recordset into a combo box
Here's how i did it.
VB Code:
'Populate the customer name combobox
strSQL = "Select CUST_NAME FROM CUST order by CUST_NAME"
OpenRsCust (strSQL)
While Not rsCust.EOF
cboCustName.AddItem (rsCust("CUST_NAME"))
rsCust.MoveNext
Wend
CloseRsCust
HTH
Re: looping data from a Recordset into a combo box