BeforeUpdate Event on txtbox (1 Viewer)

Hackcess2007

Registered User.
Local time
Today, 15:36
Joined
Mar 8, 2014
Messages
47
Simple enough really! So I thought.
A txtbox and I need the user to put a value of some sort in there so I know where the heck he is taking the equipment off to. You would think they would do that sort of thing but not. Can't do it at the tbl level as each of the boys have their own form with different goings on. So here it is.

The user clicks on their name and their entry form opens up with focus in the (where the heck are you taking my equipment to text box) if he clicks out of it...It would be great to pop up the msgbox and let him know he needs to let me know where he might bring the equipment and then set the focus back in the Txt box after the msgbox is closed.
I have given it a good try. as a matter fact I got it figured out in 2007 but 2013 seem to have a good laugh.
2007 [JobNumber]Is Null CancelEvent
...Mesgbox bla bla bla
... GoToControl [JobNumber]
Thanks:) for your help
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
19,248
do the test on the OnExit event of your control.

If Trim([Forms]![yourForm]![controlName] & "") = "" then
messabox "your message"
CancelEvent
End If
 

Graham1894

Registered User.
Local time
Today, 23:36
Joined
Apr 1, 2016
Messages
15
I have some forms where it is important that some text boxes are completed.
I do it through the on click event of the save and close button of the form (I only call it save and close because some people panic if they do not see save). All it does is check for blank boxes before it closes and stops the macro before it closes the form if it finds any, example below;
If IsNull ([Type]) Then
MessageBox Please select a job type
Beep Yes
Type None
Title No Job Type
StopMacro
End If

If IsNull ([Fee]) Then
MessageBox A fee for this job must be inserted in the Fee box
Beep Yes
Type None
Title No Job Fee
StopMacro
End If

CloseWindow
 

Hackcess2007

Registered User.
Local time
Today, 15:36
Joined
Mar 8, 2014
Messages
47
Thanks arnelgp.
It seems to do the trick quite nicely, Just wondering How the Trim function makes this work.
 

Users who are viewing this thread

Top Bottom