Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello all,
Here in my application I am performing 2 tasks:
[1]display all values on cmbrno_click()

[2]display all values on cmbfulnm_lostfocus()

and cmbrno style is 2-dropdown list.

Private Sub CmbFulNM_LostFocus()
RES.Open "student_record_database",CON,adOpenDynamic,adLockOptimistic,adCmdTable

For i = 0 To RES.RecordCount - 1              
            CmbRNO.Text = RES!ROLLNO // at this line control goes to the cmbrno_click event which is having same part of coding and executes that also.

            TxtFNM.Text = RES!FIRST_NAME  //error like: item not fount in  corresponding ordinal

            TxtMIDNM.Text = RES!MIDDLE_NAME
            TxtLNM.Text = RES!LAST_NAME
            Text5.Text = RES!CONTACT
            Text6.Text = RES!CONTACT1
            Text7.Text = RES!CONTACT2
            TxtADDR.Text = RES!ADDRESS
            COMBO1.Text = RES!GRADE
            CmbDiv.Text = RES!DIV
            CmbBG.Text = RES!BLOOD_GROUP
If CmbRNO.ListCount > 0 Then CmbRNO.ListIndex = i   
Next i
RES.Close
End Sub


Please help.
Posted
Updated 1-Feb-13 22:00pm
v2

1 solution

I'm GUESSING from the title you have code being executed when you load the combobox?

If thats the case you can set a variable and check it in the affected code...

public busy as boolean

sub load_cmbo
busy = true ' Before executing your code, set to true
....
....
....
busy = false ' set to false on exit (also in any error routines)
end sub

sub whatever on change()
if busy = true then exit sub ' This will exit as long as load_cmbo is executing
.....
end sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900