if i run the program it goes hang here is the code

Set rs = New ADODB.Recordset
    With rs
    .Open "Select * from tblCandidates1", cn, 2, 3
    Do While Not .EOF
    If !Position = Combo1.Text Then
    Combo1.AddItem !Name
    ElseIf !Position = Combo2.Text Then
    Combo2.AddItem !Name
    ElseIf !Position = Combo3.Text Then
    Combo3.AddItem !Name
    ElseIf !Position = Combo4.Text Then
    Combo4.AddItem !Name
    ElseIf !Position = Combo5.Text Then
    Combo5.AddItem !Name
    ElseIf !Position = Combo6.Text Then
    Combo6.AddItem !Name
    ElseIf !Position = Combo7.Text Then
    Combo7.AddItem !Name
        Exit Do
    End If
End With

elp me please

Edited by Ezzaral: Added code tags. Please use them to format any code that you post. (And the word you're looking for is "help")

5 Years
Discussion Span
Last Post by BitBlt

Not a lot to go on here. At first glance, it appears that the construction of your mega-IF/ELSIF construct will never get the the ".MoveNext" on line 24 because it has to fail every condition before it goes to the next row. So, if you have "!Position" match any of the criteria, the loop will simply repeat over and over, never advancing to the next row.

However, if that's not the problem, there is other information that needs to be supplied before we can help. Where are you setting the connection (I assume the variable "cn" is your connection)? Which statement actually hangs? Have you tried to step-execute to see how the logic actually flows? And so on.


SIr i have a Table for candidates then i want to call there names on the combobox do you have a code for that? or exemple related on my case study?


No, I don't have any information on that. I don't do anyone's homework for them. You asked a question, I gave pointers to help you solve it. If you need more fundamental coding examples, I recommend you use google to search it out.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.