Computing.Net > Forums > Programming > Populating Combo Box

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Populating Combo Box

Reply to Message Icon

Name: gardenair
Date: March 20, 2004 at 07:21:52 Pacific
OS: win98
CPU/Ram: 900
Comment:

Iam using ADO & there r 10 Roll numbers in Roll Number Field.
I want to populate combo box at form load event & see all 10 roll numbers
in the combo box.

I use the code in form load event

Combo1.AddItem (rec.Fields(0))

but using it,it only show Roll number 1 in combo box. How can i get the remaining
9 Roll numbers which are in the database? Is there need for loop.If yes then
how can i use it or there is any other way to see all 10 roll numbers populated
in combo box.


2--My second problem is when i see the 1 in combo box i want to see the
crosponding fields by clicking 1 .
Suppose i click on 1 at combo box & it will show the Name & address of the stiudent
in the text boxes.
Please guide me that how can i do that.
Thanks in advance for the help.



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: March 20, 2004 at 11:20:50 Pacific
Reply:

Put the rec.Fields(0)) inside a While/Wend loop and a move next statement after the rec.fields(0) statement.


2. Use the contents of the combo item selected in an SQL statement.

SELECT * FROM addresstable WHERE rollno = combo1

Populate your text boxes with the resultant recordset.

Stuart


0

Response Number 2
Name: zhap018
Date: March 20, 2004 at 15:51:27 Pacific
Reply:

Populate the combobox like this....

Do while not rsData.eof
call Combo1.AddItem(rsData.Fields(0))
rsData.MoveNext
Loop


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Populating Combo Box

Populating a combo box vba www.computing.net/answers/programming/populating-a-combo-box-vba/15098.html

VBA combo boxes www.computing.net/answers/programming/vba-combo-boxes/8950.html

Combo Box ... www.computing.net/answers/programming/combo-box-/9906.html