Refocusing on a required field if IsNull

mba1942

Registered User.
Local time
Today, 13:44
Joined
Apr 5, 2012
Messages
16
I am new to much of the form field focus functionality...

On a time reporting form, the user must enter a NAME selected from a dropdown (combo) list.

The focus is set to this (NAME) field on form entry. If the field is left blank, OnExit, a MsgBox shows "You Must Enter a Name."

Under this situation (Null field), I want to set the cursor back to the NAME entry field instead of going to the next field on the form. I've tried Me.Name.SetFocus but that doesn't seem to work.

Additionally, how can I purposfuly move to ANY field on the form.
Thanks for your help!
MBA
 
Try using the BeforeUpdate event of the textbox that you want to require the field for:

Put some code like this:

If me.Name is null or me.Name = "" then
Cancel = True
me.lblMessage = "Name is required!"
end if

To purposefully move to a control - either set the tab order the way you want it or on the OnExit event of the textbox:

NextControl.SetFocus()
 

Users who are viewing this thread

Back
Top Bottom