moving from a check box to the next field.

R

Rani

how do I move from a check box or an option group to the next field ?
I want the cursor to move automatically to the next field after the option
group or the check box was selected.
any idea ?
 
R

Rani

ok here is what I have in the after update event:

Me.BoxPurOpt.Visible = Me.CbPurOption
Me.LBLPurchaseAmount.Visible = Me.CbPurOption
Me.LBLPurchaseAmount.SetFocus

the only issue is that if the user will uncheck the box he will get a run
time error 2110

what's the correct way for doing so ?
 
B

Bruce M. Thompson

ok here is what I have in the after update event:
Me.BoxPurOpt.Visible = Me.CbPurOption
Me.LBLPurchaseAmount.Visible = Me.CbPurOption
Me.LBLPurchaseAmount.SetFocus

the only issue is that if the user will uncheck the box he will get a run
time error 2110

what's the correct way for doing so ?

Only set the focus when the is visible:

'***
Me.BoxPurOpt.Visible = Me.CbPurOption
Me.LBLPurchaseAmount.Visible = Me.CbPurOption

'Only set focus to a visible or enabled control
If Me.LBLPurchaseAmount.Visible Then
Me.LBLPurchaseAmount.SetFocus
End If
'***
 
B

Bruce M. Thompson

Only set the focus when the is visible:

Should read:

Only set the focus when the *control* is visible. <g>
 

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