status validation help

  • Thread starter Thread starter Gabe
  • Start date Start date
G

Gabe

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
 
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
 
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. =)
 
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 said:
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
 
Back
Top