Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    validation rule (A2002)

    I have both a ActivateDate and a DeactivateDate field in a table. ActivateDate has a default value of Now(). I'm trying to set a validation rule of <[ActivateDate]. I'm getting the error "invalid SQL syntax - cannot use multiple columns in a column-level CHECK constraint.

    What am I doing wrong?

    Elizabeth

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: validation rule (A2002)

    In which field are you trying to set the validation rule, for the ActivateDate or the DeactivateDate?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: validation rule (A2002)

    Hi Elizabeth,

    You can't refer to other fields in the validation rule for a field. If you want to compare values of different fields, you must create a validation rule for the table as a whole. To do so, open the table in design view and select View | Properties. Enter an expression in the Validation Rule property; since this is at the table level, you must include both fields:

    [ActivateDate] <= [DeactivateDate]

    and enter an appropriate text in the Validation Text property. Note: the Validation Rule describes which values are OK; in the above example I assumed that ActivateDate should not be later than DeactivateDate. Adapt if necessary.

  4. #4
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: validation rule (A2002)

    Thanks, Hans. That's exactly what I needed to know.

    Elizabeth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •