Hello everyone ,it's my first time in VBA coding and i didn't know it can be so frustrating all i wanna do is fill a ComboBox from a recordset so i used the following code
''' rsPhysicians is the name of the record set and cmdPhysician is the '''combobox
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
counter = 0
With rsPhysicans
Do While Not .EOF
cmbPhysicians.AddItem ![FNAME] + " " + ![MNAME] + " " + ![LNAME]
cmbPhysicians.ItemData(counter) = ![ID]
.MoveNext
counter = counter + 1
Loop
.Close
End With
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
for some reason it keep giving me the following error:
run-time error '424'
Object required
''
the error is highliting the following line
cmbPhysicians.ItemData(counter) = ![ID]
i have no idea why and i've tried a dozen way to fill the item data but i'm failing always
please helpppppppppppp
''' rsPhysicians is the name of the record set and cmdPhysician is the '''combobox
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
counter = 0
With rsPhysicans
Do While Not .EOF
cmbPhysicians.AddItem ![FNAME] + " " + ![MNAME] + " " + ![LNAME]
cmbPhysicians.ItemData(counter) = ![ID]
.MoveNext
counter = counter + 1
Loop
.Close
End With
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
for some reason it keep giving me the following error:
run-time error '424'
Object required
''
the error is highliting the following line
cmbPhysicians.ItemData(counter) = ![ID]
i have no idea why and i've tried a dozen way to fill the item data but i'm failing always
please helpppppppppppp