1,105,585 Community Members

Need help in populating combobox with dropdownlist style

Member Avatar
Jake.20
Junior Poster
124 posts since Feb 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I'm stuck on this problem for about 2 days now and i still can't find a way on how to bind my data column on the combobox. need help guys i really appriciate your help.

And this is the code i have made so far.

Private Sub Form_Load()
    adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GradingSystem.mdb;Persist Security Info=False"
    adodc1.RecordSource = "Select student_section from student_tbl"
    Set cmbBoxSection.DataSource = adodc1
End Sub
Member Avatar
AndreRet
Industrious Poster
4,492 posts since Jan 2008
Reputation Points: 362 [?]
Q&As Helped to Solve: 499 [?]
Skill Endorsements: 24 [?]
 
0
 

Do you HAVE to use the datacontrol? If not, there is a much easier way by just looping through the records returned...

Member Avatar
Jake.20
Junior Poster
124 posts since Feb 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Now i'm done in populating the combobox but the problem is the item is duplicating like for example i have two student with the same section

Student 1 - Section-1
Student 2 - Section-1

The item inside the combobax has two Section-1 instead of one section-1 only. Any tip sir

Member Avatar
rishif2
Posting Whiz in Training
284 posts since Dec 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 58 [?]
Skill Endorsements: 4 [?]
 
1
 

use of distinct will result in what you want(it will return only dictinct values i.e different values only)

"Select distinct student_section from student_tbl"

hope this helps you . . .

Member Avatar
Jake.20
Junior Poster
124 posts since Feb 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks rishif!

Question Answered as of 1 Year Ago by AndreRet and rishif2
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article