bound DBCombo

deell
12-18-2003, 06:48 PM
can Data Bound Combo bound to DAO or whatever other than Data Control?

for example: i have a dbcombo named DBCombo1 and set it's RowSource property to Data1 (Data1 is a Data Control), and ListField property to StudentCode. This will automatic list all the StudentCode when running the program. My question is, other than bount to Data1, is that any other method? I got a recordset named rsStudent, and i wish that the dbcombo can bound to it, but not Data1. can this work? and how?

pls advise, tq.

bvmantos
12-18-2003, 07:30 PM
can Data Bound Combo bound to DAO or whatever other than Data Control?

for example: i have a dbcombo named DBCombo1 and set it's RowSource property to Data1 (Data1 is a Data Control), and ListField property to StudentCode. This will automatic list all the StudentCode when running the program. My question is, other than bount to Data1, is that any other method? I got a recordset named rsStudent, and i wish that the dbcombo can bound to it, but not Data1. can this work? and how?

pls advise, tq.Then just set the rowsource property to that recordset. in your form load event, you try to do this

dbcombo1.Listfield=Studentcode
set dbcombo1.rowsource=rsStudent

or u can also use ordinary combo box w/c is much better..all u huv to do is open a recordset, then fill the combo box.

rs.movefirst
Do while not rs.EOF
combo1.addItem rs("StudentCode")
rs.movenext
LOOP


Cheers,

mikechan8888
12-18-2003, 07:51 PM
Then just set the rowsource property to that recordset. in your form load event, you try to do this

dbcombo1.Listfield=Studentcode
set dbcombo1.rowsource=rsStudent

or u can also use ordinary combo box w/c is much better..all u huv to do is open a recordset, then fill the combo box.

Do while not rs.EOF
rs.movefirst
combo1.addItem rs("StudentCode")
rs.movenext
LOOP


Cheers,
bvmantos, you better move rs.movefirst out from the while loop or you'll enter an endless loop. :)

Mike

bvmantos
12-18-2003, 09:32 PM
Then just set the rowsource property to that recordset. in your form load event, you try to do this

dbcombo1.Listfield=Studentcode
set dbcombo1.rowsource=rsStudent

or u can also use ordinary combo box w/c is much better..all u huv to do is open a recordset, then fill the combo box.

rs.movefirst
Do while not rs.EOF
combo1.addItem rs("StudentCode")
rs.movenext
LOOP


Cheers,
bvmantos, you better move rs.movefirst out from the while loop or you'll enter an endless loop. :)

MikeOh yes...i didnt notice it...thanks bro!

deell
12-21-2003, 10:33 PM
thank you for your reply.

i had try your the code by does work. i had try to put your code in click event, i had try this 'Set DBCombo1.RowSource = db.OpenDatabase([sql]...)', also still cannot work.
i know the method that use comboBox will work, but this not suitable for my program. i need to use DBCombo.
any further advise?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum