Results 1 to 4 of 4
  1. #1
    lrydbom15 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2

    IIF statement to select proper column data

    I have a simple DB that I am working on that contains 3 date fields. Using these fields I want to be able to select the correct column based on a set criteria. I thought I had it figured out, however, I am not getting the right info to populate my new column.



    Here is a brief description of what I am looking for, followed by the code I used.

    The three date columns are "Estimated Ship Date", "Ready to Ship Date" and "Actual Ship Date" and I am basing the decision criteria on a column named "Product Type". I am looking to first determine whether or not the "product Type" column is not equal to "Small Crawler" or "Large Crawler", if it is not then I want to use the "Actual Ship Date" if it's populated and the "Estimated Ship Date" if not. If it is equal to "Small Crawler" or "Large Crawler", then I want to pull in the "Ready to Ship Date" if it's populated and the "Actual Ship Date" if not.

    Inv Date: IIf([Product Type]<>"Small Lattice" Or "Large Lattice",(IIf(IsNull([Actual Ship Date]),[Estimated Ship Date],[Actual Ship Date])),(IIf(IsNull([Ready to ship date]),[Estimated Ship Date],[Ready to ship date])))

    Thanks for the help!
    Lance

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Think you need to amend as follows:

    IIf([Product Type]<>"Small Lattice" AND [Product Type]<> "Large Lattice",(IIf(IsNull([Actual Ship Date]),[Estimated Ship Date],[Actual Ship Date])),(IIf(IsNull([Ready to ship date]),[Estimated Ship Date],[Ready to ship date])))

  3. #3
    lrydbom15 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2
    Thanks, JD!! That work perfectly. I appreciate your help!

    Lance

  4. #4
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    No problem - happy to help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-10-2012, 06:41 PM
  2. Replies: 1
    Last Post: 03-14-2011, 10:04 AM
  3. Ensuring Proper Data Entry
    By skg in forum Forms
    Replies: 5
    Last Post: 01-27-2011, 10:12 PM
  4. select statement
    By jellybeannn in forum Access
    Replies: 5
    Last Post: 08-13-2010, 05:21 AM
  5. Replies: 1
    Last Post: 04-15-2010, 02:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums