Results 1 to 3 of 3
  1. #1
    JohnBoy is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    43

    IIF In Query that refers to other field names

    Hi



    I have a query that I want to amend so that at run time it looks for a value in one field and dependant on the value returned uses one of 2 other fields values to populate itself,

    So:
    Field to populate is called LatestCode,
    Fields to check are AuditDate (see if it has a date in it)
    Result Fields are OrigCode and NewCode

    I have the following LATESTCODE: IIf([AuditDate]<=0,[OrigCode],[NewCode])

    I am not getting any reult from this just, I have never used other field names to populate the new field like this so is it actually possible to do this or have I missed something in the formula..

    Any help welcome

    Regards

    JB

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    That should work, though I think the test is off. If you're looking for a date, try this:

    IIf(IsDate([AuditDate]),[NewCode],[OrigCode])
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JohnBoy is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    43
    Hi thanks for that it works fine now, it was obviouslyt the date bit that I had wrong.

    Many thanks again

    JB

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

Similar Threads

  1. Replies: 1
    Last Post: 05-17-2010, 12:21 PM
  2. Verify CSV Field Names Before Importing
    By johnson in forum Import/Export Data
    Replies: 2
    Last Post: 01-26-2010, 06:53 PM
  3. Changing field names in queries
    By scottsoo9 in forum Queries
    Replies: 1
    Last Post: 12-01-2009, 05:47 PM
  4. Replies: 5
    Last Post: 03-31-2009, 09:16 PM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

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