I have a Combo box on a form and want to populate from table with vba code. The query has two columns proc_name and then ID and have set combo box column count as 2, but when form is loaded I see ID first and then proc_name. Why is this happening?
For the other combo box with similar table structure they show column order how I have defined in the query.
Private Sub Form_Load()
Dim strSQL As String
createCon
strSQL = "Select proc_name, ID from tblProcess"
Set objRecordset = New ADODB.Recordset
objRecordset.Open strSQL, objConnection, adOpenKeyset, adLockOptimistic
If Not (objRecordset.EOF And objRecordset.BOF) Then
Set Me.cmbProcess.Recordset = objRecordset
End If
objRecordset.Close
Set objRecordset = Nothing
End Sub
strSQL = "Select proc_name AS f1, ID AS f2 from tblProcess"
– HansUp