A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Input Required



 
 
Thread Tools Display Modes
  #1  
Old September 27th, 2005, 11:27 PM
Steven R via AccessMonster.com
external usenet poster
 
Posts: n/a
Default Input Required

I developed a input form for users to input and one of the fields is
expiration date - I know that I can make that a required field, but can I
make a more custom-designed message using VBA code that would prompt the user
to input an expiration date if they tried to get off the expiration date
field ?


--
Message posted via http://www.accessmonster.com
  #2  
Old September 28th, 2005, 12:02 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Tue, 27 Sep 2005 22:27:43 GMT, "Steven R via AccessMonster.com"
u12024@uwe wrote:

I developed a input form for users to input and one of the fields is
expiration date - I know that I can make that a required field, but can I
make a more custom-designed message using VBA code that would prompt the user
to input an expiration date if they tried to get off the expiration date
field ?


Well, what would you do if they never set focus to the expiration date
field at all!?

Instead, use the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!txtExpirationDate) Then
MsgBox "Expiriation date must be filled in", vbOKOnly
Cancel = True
Me!txtExpirationDate.SetFocus
End If
End Sub

John W. Vinson[MVP]
  #3  
Old September 28th, 2005, 05:42 PM
Steven R via AccessMonster.com
external usenet poster
 
Posts: n/a
Default

John,
Thanks !

Steve


John Vinson wrote:
I developed a input form for users to input and one of the fields is
expiration date - I know that I can make that a required field, but can I
make a more custom-designed message using VBA code that would prompt the user
to input an expiration date if they tried to get off the expiration date
field ?


Well, what would you do if they never set focus to the expiration date
field at all!?

Instead, use the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!txtExpirationDate) Then
MsgBox "Expiriation date must be filled in", vbOKOnly
Cancel = True
Me!txtExpirationDate.SetFocus
End If
End Sub

John W. Vinson[MVP]



--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200509/1
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Input Form vba help mdalzell General Discussion 0 April 8th, 2005 03:57 PM
unable to repair inobox Sudheer Mumbai General Discussion 1 February 20th, 2005 11:55 AM
Input Mask Loi New Users 1 November 18th, 2004 05:44 PM
"Input" data sheet Kev General Discussion 0 November 3rd, 2004 12:15 PM
Auto input? Crystal Worksheet Functions 0 February 10th, 2004 09:10 PM


All times are GMT +1. The time now is 05:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.