Setting ListIndex within an AfterUpdate Event

A

Ashley

Can someone please explain why the following code causes a "Run-time error
'7777': You have used the listindex property incorrectly" error on the
second last line of the code.

The two combo boxes are identicle and I am using the same stored procedure
as the rowsource. Setting the listIndex for the first combo box works fine
but not the second combo box. It doesn't make sense to me.


----------------------------------------------------------------------------------------
Option Compare Database

Private Sub Form_Load()
Me.Combo1.RowSource = "EXEC spGetSourceSupplierList"

Me.Combo1.SetFocus
Me.Combo1.ListIndex = 0

End Sub

Public Sub Combo1_AfterUpdate()
Me.Combo2.RowSource = "EXEC spGetSourceSupplierList"

Me.Combo2.SetFocus
Me.Combo2.ListIndex = 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top