![]() |
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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 | |
|
|