473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Probably a simple question....

I've gotten this far:

When a field is left blank, I have a message box popping up that says
"You must enter a name." This is the code that used:

Private Sub Entered_By_Exit(Cancel As Integer)
If IsNull(Me![Entered by]) Then MsgBox "You must enter a name"
End Sub

Now the only addition I want to do that I can't figure out is is that
I want the cursor to return to that field that created the message
box. As it is now, the cursor moved on to the next field.

Thanks!
Nov 12 '05 #1
3 1154
On 23 Feb 2004 12:22:53 -0800, mh********@yahoo.com (MatGyver) wrote:

Re-read the help page on the Exit event. It will say something about
the Cancel argument: if you set it to True, the user won't be able to
leave the field.

BTW, I prefer such checks in the Form_BeforeUpdate event. What if the
user is very mouse-centric and never entered the [Entered by] field?
Your code would not fire; mine would.

BTW2: Entered by can typically be a hidden field, programmatically set
to the name of the logged in user. See
http://www.mvps.org/access/api/api0008.htm for details.

-Tom.

I've gotten this far:

When a field is left blank, I have a message box popping up that says
"You must enter a name." This is the code that used:

Private Sub Entered_By_Exit(Cancel As Integer)
If IsNull(Me![Entered by]) Then MsgBox "You must enter a name"
End Sub

Now the only addition I want to do that I can't figure out is is that
I want the cursor to return to that field that created the message
box. As it is now, the cursor moved on to the next field.

Thanks!


Nov 12 '05 #2
Tom,

You can also use the SetFocus property to move the cursor back to the field
in question.

Regards

Richard Walters

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:et********************************@4ax.com...
On 23 Feb 2004 12:22:53 -0800, mh********@yahoo.com (MatGyver) wrote:

Re-read the help page on the Exit event. It will say something about
the Cancel argument: if you set it to True, the user won't be able to
leave the field.

BTW, I prefer such checks in the Form_BeforeUpdate event. What if the
user is very mouse-centric and never entered the [Entered by] field?
Your code would not fire; mine would.

BTW2: Entered by can typically be a hidden field, programmatically set
to the name of the logged in user. See
http://www.mvps.org/access/api/api0008.htm for details.

-Tom.

I've gotten this far:

When a field is left blank, I have a message box popping up that says
"You must enter a name." This is the code that used:

Private Sub Entered_By_Exit(Cancel As Integer)
If IsNull(Me![Entered by]) Then MsgBox "You must enter a name"
End Sub

Now the only addition I want to do that I can't figure out is is that
I want the cursor to return to that field that created the message
box. As it is now, the cursor moved on to the next field.

Thanks!

Nov 12 '05 #3
On Mon, 23 Feb 2004 21:19:40 -0000, "Richard Walters"
<ri*****@walters225nospam.freeserve.co.uk> wrote:

Perhaps. Although that doesn't work in the comparable LostFocus event.
I consider:
Cancel = True
a lot better than:
SomeControl.SetFocus
because it uses the infrastructure already provided by Access, and is
therefore likely more bulletproof. For example in cases where focus is
lost to another (popup) form.

-Tom.

Tom,

You can also use the SetFocus property to move the cursor back to the field
in question.

Regards

Richard Walters

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:et********************************@4ax.com.. .
On 23 Feb 2004 12:22:53 -0800, mh********@yahoo.com (MatGyver) wrote:

Re-read the help page on the Exit event. It will say something about
the Cancel argument: if you set it to True, the user won't be able to
leave the field.

BTW, I prefer such checks in the Form_BeforeUpdate event. What if the
user is very mouse-centric and never entered the [Entered by] field?
Your code would not fire; mine would.

BTW2: Entered by can typically be a hidden field, programmatically set
to the name of the logged in user. See
http://www.mvps.org/access/api/api0008.htm for details.

-Tom.

>I've gotten this far:
>
>When a field is left blank, I have a message box popping up that says
>"You must enter a name." This is the code that used:
>
>Private Sub Entered_By_Exit(Cancel As Integer)
> If IsNull(Me![Entered by]) Then MsgBox "You must enter a name"
>End Sub
>
>Now the only addition I want to do that I can't figure out is is that
>I want the cursor to return to that field that created the message
>box. As it is now, the cursor moved on to the next field.
>
>Thanks!


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: LeROY | last post by:
I need to output some related data tables as XML. I have my data adapters and my dataset with the relations defined. It is certainly simple enough to use the dataset.WriteXML function. However,...
7
by: Jim H | last post by:
I'm new to gui programming. I'm just doing some testing with forms. I've dropped a com control on a form. When a user clicks and holds the mouse down on the control I'd like to drag the form...
1
by: jm | last post by:
Easy probably, please read on. I know some of you have commented already about some of my socket question. I appreciate that. I have a Form1: static void Main() { Application.Run(new...
3
by: John Salerno | last post by:
I have two files: public class Tester { public static void Main() { Program begin = new Program(); begin.StartCalculator(); } }
2
by: Ron | last post by:
I want to add radio buttons to a datagrid. The datagrid is displaying 5-10 items, and I want the user to select the desired item via radiobutton. As it is, the user can select as many radiobuttons...
4
by: Adrian von Bidder | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yo! Mostly as a finger-exercise (and because I'm annoyed again and again how bad the existing solutions are), I'm hacking up a web-based forum...
3
by: Rangy | last post by:
Hi, I've decided to take the plunge and move from tables to a pure css layout. I still "think" in tables when I do my layouts and I was wondering the following: I have a simple, standard two...
3
maxx233
by: maxx233 | last post by:
Hello, I'm developing a simple program to control a video switcher we have via RS232. All the backend control stuff is figured out just fine, the interface is what's giving me problems! I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.