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  

status validation help



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2010, 12:22 AM posted to microsoft.public.access.forms
Gabe
external usenet poster
 
Posts: 83
Default status validation help

Hello, I need some help coding this one...

I have 3 fields in a form Amount, Date, and Status. If the user inputs an
Amount then they must enter a "Date" in order for the database to accept a
Complete "Status".

The Status field has several drop down choices, Open, Pending, Complete, etc.

Any help would be greatly appriciated!!

Thanks,
~Gabe
Ads
  #2  
Old June 4th, 2010, 01:22 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default status validation help

On Thu, 3 Jun 2010 16:22:09 -0700, Gabe
wrote:

Hello, I need some help coding this one...

I have 3 fields in a form Amount, Date, and Status. If the user inputs an
Amount then they must enter a "Date" in order for the database to accept a
Complete "Status".

The Status field has several drop down choices, Open, Pending, Complete, etc.

Any help would be greatly appriciated!!

Thanks,
~Gabe


Use the Form's BeforeUpdate event to check that the data is valid; e.g.

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me![Date]) AND Me![Status] = "Complete" Then
Cancel = True
MsgBox "Please enter a date before selecting COMPLETE"
End If
End Sub

--

John W. Vinson [MVP]
  #3  
Old June 4th, 2010, 01:34 AM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default status validation help

OK, if the user inputs an Amount then they must enter a "Date" in order for
the database to accept a
Complete "Status." What if an amount is not input, can the status "Complete"
then be acceptable?

Also, if your field/control iss actually named "Date" you need to change that.
"Date" is a Reserved Word in Access VBA and you may very well confuse the
Access Gnomes!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

  #4  
Old June 4th, 2010, 05:00 PM posted to microsoft.public.access.forms
Gabe
external usenet poster
 
Posts: 83
Default status validation help

Yes, if they don't put an amount then the "Complete" status is still
acceptable, sometimes costs are not inccured but if they do put an amount in
then they must enter a date or "PaidDate" down before they can select a
complete status. MS should replace the gnomes with oompaloompas. =)

"Linq Adams via AccessMonster.com" wrote:

OK, if the user inputs an Amount then they must enter a "Date" in order for
the database to accept a
Complete "Status." What if an amount is not input, can the status "Complete"
then be acceptable?

Also, if your field/control iss actually named "Date" you need to change that.
"Date" is a Reserved Word in Access VBA and you may very well confuse the
Access Gnomes!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

.

  #5  
Old June 4th, 2010, 05:23 PM posted to microsoft.public.access.forms
Gabe
external usenet poster
 
Posts: 83
Default status validation help

That worked great, I had to tweak it a little...thank you John!

Private Sub Form_BeforeUpdate(Cancel As Integer)
If (Me![Amount]) 0 And IsNull(Me![PaidDate]) And Me![Status] = "Complete"
Then
Cancel = True
MsgBox "Please enter a date before selecting COMPLETE"
End If
End Sub

~Gabe

"John W. Vinson" wrote:

On Thu, 3 Jun 2010 16:22:09 -0700, Gabe
wrote:

Hello, I need some help coding this one...

I have 3 fields in a form Amount, Date, and Status. If the user inputs an
Amount then they must enter a "Date" in order for the database to accept a
Complete "Status".

The Status field has several drop down choices, Open, Pending, Complete, etc.

Any help would be greatly appriciated!!

Thanks,
~Gabe


Use the Form's BeforeUpdate event to check that the data is valid; e.g.

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me![Date]) AND Me![Status] = "Complete" Then
Cancel = True
MsgBox "Please enter a date before selecting COMPLETE"
End If
End Sub

--

John W. Vinson [MVP]
.

 




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 07:49 AM.


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