SetFocus Problem + AfterUpdate Problem

L

Luis

Hello.
I have 2 problems on a insert form. The first one is with
a SetFocus property that is not working. The problem is
that the users have to insert a code that must be unique,
and i created a msg that appear if the code already
exists, and this is working. But i want that, when the
user clicks OK in the MsgBox the focus returns to the code
textbox, and stay there until the user enters a new code.

The second problem is with a Username Password validation.
I have AfterUpdate event on the password textbox to
validate the user, with a message if the user is not
valid. So far so good. The problem is if the user just
press Enter in the text fields with Null values. If this
happens the AfterUpdate event doesn't work. How can i do
sometihing like the AfterUpdate event in this situation.
 
M

Marshall Barton

Luis said:
I have 2 problems on a insert form. The first one is with
a SetFocus property that is not working. The problem is
that the users have to insert a code that must be unique,
and i created a msg that appear if the code already
exists, and this is working. But i want that, when the
user clicks OK in the MsgBox the focus returns to the code
textbox, and stay there until the user enters a new code.

The second problem is with a Username Password validation.
I have AfterUpdate event on the password textbox to
validate the user, with a message if the user is not
valid. So far so good. The problem is if the user just
press Enter in the text fields with Null values. If this
happens the AfterUpdate event doesn't work. How can i do
sometihing like the AfterUpdate event in this situation.


Why don't you use the BeforeUpdate event? It has a Cancel
argument that will prevent the focus from moving, so you
don't have to worry about trying to use SetFocus at a time
when it can't be used.
 

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