Hi Ajax, I put together a function using your recommendation:
Code:
Function GetComboBoxData()
On Error GoTo errhandler
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim recordSourceData As String
Set con = New ADODB.Connection
With con
.ConnectionString = GetConnectionString("MNCatalog")
.Open
End With
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = con
.Open "SELECT DISTINCT" & _
" Category" & _
", ProductDescription" & _
", BasePrice" & _
", AdditionalPrintPrice" & _
", MinimumPurchaseAmount" & _
"FROM z_PriceCategories " & _
"ORDER BY Category;", , adOpenStatic, adLockReadOnly
End With
While Not rs.EOF
recordSourceData = recordSourceData & _
CStr(ADORS.Fields(0)) & ";" & _
CStr(ADORS.Fields(1)) & ";" & _
CStr(ADORS.Fields(2)) & ";" & _
CStr(ADORS.Fields(3)) & ";" & _
CStr(ADORS.Fields(4)) & ";"
rs.MoveNext
Wend
eofit:
On Error Resume Next
con.Close
rs.Close
Set con = Nothing
Set rs = Nothing
Exit Function
errhandler:
z = ErrorFunction(Err, Err.Description, Erl, "GetComboBoxData", , True)
Err = 0
Select Case z
Case 0: Resume Next
Case 1: GoTo eofit
End Select
End Function
I still do not understand how can I use the string populated with the recordset data as the rowsource of the combobox.