arrValues = rst.GetRows()
With Customer.cboxCustomer
.List = arrValues + "*"
.List = Application.Transpose(arrValues)
End With
.List = Application.Transpose(arrValues) ' add recordset
.AddItem "All", 0 'add All at the top of the list.
strSQL = "SELECT * FROM TABLE1"
If Combobox1.Value <>"All" Then
' add criteria
strSQL = strSQL & " WHERE Field1 ='" & Combobox1.Value &"'"
End If
Dim arrValues
.
.
.
Set rst = New ADODB.Recordset
rst.Open "SELECT [Name] FROM [Data Connection TBL] GROUP BY [Name];", cnn, adOpenForwardOnly, adLockReadOnly, adCmdText
arrValues = rst.GetRows()
'Fill ComboBox
'---------------------------------------------------------------------------------------------------------------------------------------
With Indemn_Customer.cboxCustomer
.List = arrValues
[COLOR=red].List = Application.Transpose(arrValues)[/COLOR]
.AddItem "All Customers", 0 'add All at the top of the list.
End With
Dim arrValues
.
.
.
Set rst = New ADODB.Recordset
rst.Open "SELECT [Name] FROM [Data Connection TBL] GROUP BY [Name];", cnn, adOpenForwardOnly, adLockReadOnly, adCmdText
If not rst.EOF then
arrValues = rst.GetRows()
'Fill ComboBox
'---------------------------------------------------------------------------------------------------------------------------------------
With Indemn_Customer.cboxCustomer
If IsArray(arrvalues) Then
.List = Application.Transpose(arrValues)
else
.List = Array(arrValues)
End If
.AddItem "All Customers", 0 'add All at the top of the list.
End With
End If
sub snb()
with New ADODB.Recordset
.Open "SELECT [Name] FROM [Data Connection TBL] GROUP BY [Name];", cnn, adOpenForwardOnly, adLockReadOnly, adCmdText
if typename(.GetRows)= "string" then
Indemn_Customer.cboxCustomer.list=split("All Customers|" & .getrows,"|")
else
Indemn_Customer.cboxCustomer.List =split("All Customers|" & join(Application.Transpose(.getrows),"|"),"|")
end if
end with
end sub
With New ADODB.Recordset
.Open "SELECT [Name] FROM [Data Connection TBL] GROUP BY [Name] ORDER BY [Name];", cnn, adOpenForwardOnly, adLockReadOnly, adCmdText
If TypeName(.GetRows) = "string" Then
Indemn_Customer.cboxCustomer.List = Split("All Customers|" & .GetRows, "|")
Else
Indemn_Customer.cboxCustomer.List = Split("All Customers|" & Join(Application.Transpose(.GetRows), "|"), "|")
End If
End With
Try this (I suspect you are only getting one result):
Rich (BB code):Dim arrValues . . . Set rst = New ADODB.Recordset rst.Open "SELECT [Name] FROM [Data Connection TBL] GROUP BY [Name];", cnn, adOpenForwardOnly, adLockReadOnly, adCmdText If not rst.EOF then arrValues = rst.GetRows() 'Fill ComboBox '--------------------------------------------------------------------------------------------------------------------------------------- With Indemn_Customer.cboxCustomer If IsArray(arrvalues) Then .List = Application.Transpose(arrValues) else .List = Array(arrValues) End If .AddItem "All Customers", 0 'add All at the top of the list. End With End If