Move Focus to control after List Box Selection

  • Thread starter Cyn via AccessMonster.com
  • Start date
C

Cyn via AccessMonster.com

I have a form on which user selects a product [in a control [Product1]. The
After Update event occurs which selects the first item in a list box
[PRiceCombo]. This works fine. Then I tried to move the focus to another
list box to make a selection there. I can not get the focus to move to any
field/control on the form (Error - 'can not move focus...'). The second one
works if I block out the first list box. Here is the code - I assume I need
to get off the selection in the first list box, but can't figure out how.

'Product price - PRiceCombo is one of the list boxes.
Me.PRiceCombo.Requery
Me.PRiceCombo.SetFocus
Me!PRiceCombo.Selected(0) = True
'unbound text box on form (this works fine)
Me.pricec = Me.PRiceCombo

'Product Tax - listTax1 is the 2nd list box.
Me.listTax1.Requery
Me.listTax1.SetFocus
Me!listTax1.Selected(0) = True
Me.Taxc = Me.Tax1

any assistance will be wonderful!
 
K

Ken Snell \(MVP\)

You do not need to put focus on a list box if you want to select an item in
the listbox. Just set the value of the listbox to the first item in the list
box:

Me.PRiceCombo.Requery
Me.PRiceCombo.Value = Me.PRiceCombo.ItemData(0)
 
C

Cyn via AccessMonster.com

thank you! I knew it would be simple, i just couldn't find it. works
perectly.
Cyn
You do not need to put focus on a list box if you want to select an item in
the listbox. Just set the value of the listbox to the first item in the list
box:

Me.PRiceCombo.Requery
Me.PRiceCombo.Value = Me.PRiceCombo.ItemData(0)
I have a form on which user selects a product [in a control [Product1]. The
After Update event occurs which selects the first item in a list box
[quoted text clipped - 21 lines]
any assistance will be wonderful!
 

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