How do you display combo box using recordset? Neither code piece given below is working. Neither rowsource nor additem is working. Editing the rowsource property in design view properties is not allowed, so I need to manually code it.
Set MyRec = MyDB.OpenRecordset("SELECT * From studentInformation")
Do While Not MyRec.EOF
comboBox.RowSource = MyRec![studentName] 'This code is not displaying anything...
MyRec.MoveNext
Loop
Or this code doesn't display anything
Set MyDB = CurrentDb
Set MyRec = MyDB.OpenRecordset("SELECT * From studentInformation")
Do While Not MyRec.EOF
tQue = MyRec![studentName]
Combo7.AddItem(tQue)
MyRec.MoveNext
Loop
If you do in VB6 .. try this
Do While Not MyRec.EOF
Combo7.AddItem MyRec.Fields.Item("studentName")
MyRec.MoveNext
Loop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.