userform combobox rowsource from database
If the post was helpful, please click the 'Yes' button to indicate such!
--
RyGuy
"Ken" wrote:
Just what I was looking for, is there anyway to populate multiple columns?
"Jeff" wrote:
Private Sub UserForm_Initialize()
Dim Recordset As ADODB.Recordset
Dim SQL As String
Set Recordset = New Recordset
SQL = "SELECT * FROM returned" '<--- Change to match your table
'The SELECT * will return everything from
'the specified table.
Recordset.Open SQL, connStr, adOpenForwardOnly, adLockReadOnly
'open the recordset
Do Until Recordset.EOF
UserForm1.ComboBox1.AddItem (Recordset.Fields.Item(3))
Recordset.MoveNext
Loop
End Sub
"Ken" wrote:
I am trying to set the rowsource for a combo box from a table in a
database, To no avail.
I am using an ADOB connection, open the recordset and try to set the fields
value to the rowSource, but I get the error "invalid property value".
I also don't see how to have a value in multiple columns.
This is my last line of attack.
Me.xtype.RowSource = rst.Fields(0).Value
Can't help but think I am going about this the wrong way.
Any information is greatly appreciated.
|