Listindex question

M

Mattias

Hi

I have used the below code with succes before when using it with the forms
"Before Insert" event.

Now using with controls AfterUpdate event I get runtime error 7777 "You used
the listindex proporty incorrectly"

Any help here is most appreciated

Mattias

Private Sub Artikel_AfterUpdate()
DoCmd.GoToControl "Auktion"
Me.Auktion.ListIndex = 0
DoCmd.GoToControl "Antal"
End Sub
 
M

Mattias

Hi thanks for replying,

It is not a multiselect box and what I want to do is get the top value in
the presorted listbox as a "default value" after this control is updated...

Mattias
 
K

Ken Snell

You could use either of the following options:


Me.ListBoxName.Value = Me.ListBoxName.ItemData(0)

or


Me.ListBoxName.Selected(0) = True
 
M

Marshall Barton

Emilia said:
don't know where and how did you use the code before, but the A2K Help
says, the ListIndex property is read only.

Since the question has been answered, I just thought I'd try
to clear up this confusion.

Help (all versions) is incomplete on this issue. It should
say something more like:

The ListIndex property is read only when the
list/combo box does not have the focus. It is
read/write when the list/combo box has the focus.
 
E

Emilia Maxim

Marshall Barton said:
Since the question has been answered, I just thought I'd try
to clear up this confusion.

Help (all versions) is incomplete on this issue. It should
say something more like:

The ListIndex property is read only when the
list/combo box does not have the focus. It is
read/write when the list/combo box has the focus.

Thank you, Marshall!

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 

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