SetFocus Problem + AfterUpdate Problem

  • Thread starter Thread starter Luis
  • Start date Start date
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.
 
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.
 
Back
Top