I want a combobox "x" to be reopened after selecting a row.

S

SOLICON

I want a combobox "x" to be reopened after selecting a row.

After selecting a row, the data is added to a table. That´s working
fine but...

I have a x.setfocus and x.dropdown at the end of the afterupdate event
routine,
but it does not dropdown again the combobox.

It drops down when I please a breakpoint in the program at the End Sub
line, of the afterupdate event routine.
When the program continues after the breakpoint, it closes again the
combobox.

What am I doing wrong?
 
J

Jerry Porter

My guess is that you're not doing anything wrong, but it appears that
Access always collapses the combo box at the end of AfterUpdate. So
that event can't be used to execute the dropdown method.

Of course, if a ListBox would work for you, this wouldn't be an issue.

I can't think of a clean way to do it, but I did get it to work by
having AfterUpdate enable the form's timer, and put the dropdown method
in the Timer event:

Private Sub x_AfterUpdate()
CurrentDb.Execute "Insert into MyTable (MyField) Select '" & Me!x &
"'"
Me.TimerInterval = 10 'enable timer. 10 milliseconds - may need
to experiment
End Sub

Private Sub Form_Timer()
x.SetFocus
x.Dropdown
Me.TimerInterval = 0 'disable timer
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