I am scratching my head over this. I have a combo box control where the afterupdate event or even the onchange event keeps runnning twice.
Below is some simple code to emulate the problem I am having.
Assume combobox control is cboTest and command button control is cmdTest.
[code=vb]
Private Sub cboTest_AfterUp date()
MsgBox ("Change")
End Sub
Private Sub cmdTest_Click()
Me.cboTest.SetF ocus
Me.cboTest.List Index = Me.cboTest.List Index - 1
End Sub
[/code]
Assume the combo box is populated with 3 text strings (whatever you want). If I make a selection using the combobox then the afterupdate event triggers once (like I want it to). If on the other hand I click on the command button it should select the previous item in the combo box.
All of this works except when I use the command button all the code in the afterupdate event of the combobox runs twice.
Any ideas what I am doing wrong or not understanding?
(Note code simplified for demonstration purposes - Note you must first select the 2nd or third item before clicking on the command button for this simple code to work. - it still fails with this simple code) - Using Access 2007
cheers,
Below is some simple code to emulate the problem I am having.
Assume combobox control is cboTest and command button control is cmdTest.
[code=vb]
Private Sub cboTest_AfterUp date()
MsgBox ("Change")
End Sub
Private Sub cmdTest_Click()
Me.cboTest.SetF ocus
Me.cboTest.List Index = Me.cboTest.List Index - 1
End Sub
[/code]
Assume the combo box is populated with 3 text strings (whatever you want). If I make a selection using the combobox then the afterupdate event triggers once (like I want it to). If on the other hand I click on the command button it should select the previous item in the combo box.
All of this works except when I use the command button all the code in the afterupdate event of the combobox runs twice.
Any ideas what I am doing wrong or not understanding?
(Note code simplified for demonstration purposes - Note you must first select the 2nd or third item before clicking on the command button for this simple code to work. - it still fails with this simple code) - Using Access 2007
cheers,
Comment