Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Location
    Orlando, Florida, USA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nested Table Validation If Statements (2000)

    Last week I posted the following question:
    I have a table that has a DeliveryDate field and a DeliveryMemo field and I am trying to create a Table level validation rule that will require a DeliveryMemo if a DeliveryDate is populated. I have tried using an If Statement but can't seen to make it work. Any ideas?

    And got the answer below:
    You can use the function IIf (Immediate If) in expressions. The general form is

    IIf(Condition, Result_if_True, Result_if_False)

    In your table, use this:

    IIf(Not IsNull([DeliveryDate]), Not IsNull([DeliveryMemo]), True)

    If the DeliveryDate is populated (not Null), test if DeliveryMemo is populated (not Null), otherwise it's always OK.

    Regards,
    Hans

    Which worked perfectly, my question now is there a way to nest this for multiple DeliveryDate and DeliveryMemo fields. Like DeliveryDate1, DeliveryMemo1, DeliveryDate2, DeliveryMemo2. I have now have 5 sets of DeliveryData and DeliveryMemo fields.

    I have tried using what I thought was standard If Statement nesting and am not able to make it work.

    Thanks for any help you can provide!
    Jill

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

    Re: Nested Table Validation If Statements (2000)

    You don't need nested IIf's here, but you must combine them using And, since the condition must hold (I presume) for each of the sets. It will look rather cumbersome:

    IIf(Not IsNull([DeliveryDate1]),Not IsNull([DeliveryMemo1]),True) And IIf(Not IsNull([DeliveryDate2]),Not IsNull([DeliveryMemo2]),True) And IIf(Not IsNull([DeliveryDate3]),Not IsNull([DeliveryMemo3]),True) And IIf(Not IsNull([DeliveryDate4]),Not IsNull([DeliveryMemo4]),True) And IIf(Not IsNull([DeliveryDate5]),Not IsNull([DeliveryMemo5]),True)

  3. #3
    New Lounger
    Join Date
    Feb 2003
    Location
    Orlando, Florida, USA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Nested Table Validation If Statements (2000)

    You are my hero!

    Thanks so much!
    Jill

Posting Permissions

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