Hi:
I'm trying to populate datacombo box from ado recordset on a form load event, using code. But when I run it, the datacombo box is empty. I tried changing my cursor type to static, as one site suggested, but it doesn't correct the problem. I appreciate any help you can give. Thanks in advance. Here's the code I used.
Private Sub Form_Load()
Dim iConn As New ADODB.Connection
Dim iRec As New ADODB.Recordset
iConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb"
iRec.Open "select PlayerName From Player", iConn, adOpenDynamic, adLockOptimistic
Set Me.DataCombo1.RowSource = iRec
Me.DataCombo1.DataField = "PlayerName"
End Sub
I'm trying to populate datacombo box from ado recordset on a form load event, using code. But when I run it, the datacombo box is empty. I tried changing my cursor type to static, as one site suggested, but it doesn't correct the problem. I appreciate any help you can give. Thanks in advance. Here's the code I used.
Private Sub Form_Load()
Dim iConn As New ADODB.Connection
Dim iRec As New ADODB.Recordset
iConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb"
iRec.Open "select PlayerName From Player", iConn, adOpenDynamic, adLockOptimistic
Set Me.DataCombo1.RowSource = iRec
Me.DataCombo1.DataField = "PlayerName"
End Sub