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  

Required Data Entry



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2004, 04:31 PM
Kenny G
external usenet poster
 
Posts: n/a
Default Required Data Entry

Currently I have my code written so that if a field is left empty a message appears telling the user that they must fill in the field. The "requirement" comes from the on exit sub procedure.

The first five fields are "required" to be filled. The user can not go back and correct a mistake until the first five fields have been filled in. ie User is on answer four and they find out they made a mistake on answer two. The user must complete the five answers before entering control tab to go backward and correct mistakes.

Is there some way that this can be overwritten on a temporary basis?

I appreciate your help.

Kenny G


  #2  
Old May 26th, 2004, 05:27 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default Required Data Entry

"Kenny G" wrote in message
...
Currently I have my code written so that if a field is left empty a

message appears telling the user that they must fill in the field. The
"requirement" comes from the on exit sub procedure.

The first five fields are "required" to be filled. The user can not go

back and correct a mistake until the first five fields have been filled in.
ie User is on answer four and they find out they made a mistake on answer
two. The user must complete the five answers before entering control tab
to go backward and correct mistakes.

Is there some way that this can be overwritten on a temporary basis?


I would put this sort of validation in the BeforeUpdate of the form rather
than OnExit of the controls. What if a required control never gets focus
in the first place? In the BeforeUpdate of the form you can test all of
the fields and display a single message indicating all of the problems.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #3  
Old May 26th, 2004, 07:21 PM
Kenny G
external usenet poster
 
Posts: n/a
Default Required Data Entry

Rick,

Thanks for your reply.

That's a great idea. Do I take each of those and put them on the before update in a Case If sub?
If I have a message indicating there are some fields that need data entry - would it be possible to
have the field turn red until the requirement is fulfilled?

Thanks, Ken


  #4  
Old May 26th, 2004, 08:01 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default Required Data Entry

"Kenny G" wrote in message
...
Rick,

Thanks for your reply.

That's a great idea. Do I take each of those and put them on the before

update in a Case If sub?
If I have a message indicating there are some fields that need data

entry - would it be possible to
have the field turn red until the requirement is fulfilled?


You can either have a series of If-Then blocks and produce a Message for
each validation failure individually or (my preference) you can accumulate
the problems and display a single message. Here is a sample of how I do
that.

Dim RqdMsg as string

RqdMsg = "The Following Required Fields Were Left Blank."
'(initially this variable has text that is 46 characters long)

If IsNull(RequiredField1) Then RqdMsg = RqdMsg & vbcrlf & "Field1"
If IsNull(RequiredField2) Then RqdMsg = RqdMsg & vbcrlf & "Field2"
'repeat as necessary

If Len(RqdMsg) 46 Then
MsgBox RqdMsg
Cancel = True
End if

During the sequence of If-Thens you certainly could add code that changed
the color of the control if you want.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #5  
Old May 26th, 2004, 08:36 PM
Kenny G
external usenet poster
 
Posts: n/a
Default Required Data Entry

Rick,

Thanks for you prompt reply, I'll try this first thing in the morning.

The more I know, the more I realize I don't know.

Thanks Again, Kenny G
  #6  
Old May 27th, 2004, 02:46 PM
Kenny G
external usenet poster
 
Posts: n/a
Default Required Data Entry

Rick,

Thanks again, it worked great this morning!

Kenny G
 




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


All times are GMT +1. The time now is 05:42 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.