Validation Rules for Data fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DBlearner
    New Member
    • Oct 2009
    • 18

    Validation Rules for Data fields

    I'm surprised I couldnt find a question about this here so guess I better ask.

    I have a form with two date fields. [StartDate] and [EndDate]. Obviously, Enddate cannot predate Startdate field so I decided to do a validation rule for both fields.

    I selected the startdate field and inserted
    Code:
    [StartDate]<=[EndDate]
    along with Validation text.

    Now, the strange thing is that no matter what date I select in the StartDate field, the validation rule fires and the Validation Text pops up.

    So I tried something different, I changed the validation rule to
    Code:
    <=[CAR Initiated Date]
    and it still wont cooperate with me. I suspect it is due to some kind of Null problem unless it's completely different.

    Matt
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    To do this in a validation rule, use something like
    for the StartDate box:
    Code:
    [StartDate] <= Nz([EndDate], #1/1/3000#)
    and for the EndDate box:
    Code:
    [EndDate] >= Nz([StartDate], #1/1/1000#)
    You could also use code in the BeforeUpdate event for the text box instead.

    Comment

    Working...