set focus?

  • Thread starter Thread starter Rover
  • Start date Start date
R

Rover

I have an unbound control that I check the entered value at After Update
time with a DLookup. I display a message saying the value doesn't
exist. All that works well.

If the entered value is invalid, I want to stay on the control so the
operator can reenter the correct value. It seems to ignore my setfocus.

I've tried the same code on the Lost Focus event with the same results.

Suggestions?

Jim
 
Use the Before Update event of the control, and add the line:
Cancel = True

This cancels the event, which keeps the user in the control

I believe the reason the SetFocus in the control's AfterUpdate has not
effect, is that the focus is still in that control when the event fires, so
it does nothing. After the event completes, then Access moves focus to the
next control as usual.
 

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

Back
Top