From: Gabe on
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
From: John W. Vinson on
On Thu, 3 Jun 2010 16:22:09 -0700, Gabe <Gabe(a)discussions.microsoft.com>
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]
From: Linq Adams via AccessMonster.com on
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

From: Gabe on
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
>
> .
>
From: Gabe on
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 <Gabe(a)discussions.microsoft.com>
> 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]
> .
>