M
Mark
Hi,
I need some help. I have a form that I will get a user to
fill out with a couple of mandatory fields/text boxes I'd
like them to fill in. And when they don't fill in the
mandatory field... a message pops up saying that they need
to fill in the field. In addition and my problem, I would
like the cursor to stay on that field before moving onto
the next field/text box.
In the text box properties, I have an [Event Procedure]
for both "AfterUpdate" and "OnExit" which pops up a
message to the user entering data into the form to enter
the information. Which works fine... however, I would
like to have the cursor stay on that particular field/text
box before continuing to the next field. I've tried
placing the code listed below in the "AfterUpdate"
and "OnExit" thinking that this would work, but it moves
the cursor to the next text box once the message
window/prompt is clicked "ok". I even placed ":
TextBoxName.SetFocus" in the If... Then statement thinking
this would work... I've listed the code below. Also, I
have tried turning the "required field properties" to yes
and no. What am I not doing right? Would the "validation
rule" and "validation text" properties be used to do
this. I am sure there is more than one way to get this to
work. I can't seem to figure this out. Can you help me?
Thanks, Mark
Below is the code I have been working with in
the "AfterUpdate" section:
Private Sub Referral_Date_AfterUpdate()
If (IsNull(Me.Referral_Date) Or Me.Referral_Date = "")
Then
MsgBox "This is a mandatory field, please enter a
response here before proceeding. If not, you will be asked
again to enter this data before exiting this page.":
Referral_Date.SetFocus
End If
End Sub
I need some help. I have a form that I will get a user to
fill out with a couple of mandatory fields/text boxes I'd
like them to fill in. And when they don't fill in the
mandatory field... a message pops up saying that they need
to fill in the field. In addition and my problem, I would
like the cursor to stay on that field before moving onto
the next field/text box.
In the text box properties, I have an [Event Procedure]
for both "AfterUpdate" and "OnExit" which pops up a
message to the user entering data into the form to enter
the information. Which works fine... however, I would
like to have the cursor stay on that particular field/text
box before continuing to the next field. I've tried
placing the code listed below in the "AfterUpdate"
and "OnExit" thinking that this would work, but it moves
the cursor to the next text box once the message
window/prompt is clicked "ok". I even placed ":
TextBoxName.SetFocus" in the If... Then statement thinking
this would work... I've listed the code below. Also, I
have tried turning the "required field properties" to yes
and no. What am I not doing right? Would the "validation
rule" and "validation text" properties be used to do
this. I am sure there is more than one way to get this to
work. I can't seem to figure this out. Can you help me?
Thanks, Mark
Below is the code I have been working with in
the "AfterUpdate" section:
Private Sub Referral_Date_AfterUpdate()
If (IsNull(Me.Referral_Date) Or Me.Referral_Date = "")
Then
MsgBox "This is a mandatory field, please enter a
response here before proceeding. If not, you will be asked
again to enter this data before exiting this page.":
Referral_Date.SetFocus
End If
End Sub