I am trying to populate a datacombo control in vb6 using ado and my challenge is that the datacombo only shows up with the first row in the collection. I have shown my code below. I want it to show all the rows in the collection
Code:
Dim Con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
Call OpenConnection
Dim strQ As String
'Raw_Material table is being used for storing reports data as it is spare
strQ = "Select Distinct Raw_Material_Description FROM Raw_Material order by Raw_Material_Description asc" ' set ascending order
rs.Open strQ, Con, adOpenForwardOnly, adLockReadOnly
Set DataCombo1.DataSource = rs
DataCombo1.DataField = "Raw_Material_Description"
rs.Close: Set rs = Nothing
Con.Close: Set Con = Nothing
End Sub
Private Sub OpenConnection()
If Con.State = 1 Then
Con.Close
End If
Con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\SBWBWIN\Simply Basic Weighbridge Control System.mdb;Persist Security Info=False"
Con.Open
End Sub