Results 1 to 3 of 3
  1. #1
    Gus is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2008
    Location
    Glasgow Scotland
    Posts
    6

    IIF Function

    Hi All

    I am relatively new to access 2010 but have a little knowledge of earlier versions.
    My problem is, How can i write a a function or query to tell if a book has been borrowed from my library. I have a table tblauthortitle with fields by Author,Book Title, Borrowed By, Date Borrowed and Return Date.


    Below is the Qurey i am running but is shows #Error in what should be Unavaiable

    Status: IIf([Date Borrowed]="Date","Unavailable","Available")

    SQL Statement
    SELECT tblauthortitle.Author, tblauthortitle.[Book Title], tblauthortitle.[Borrowed By], tblauthortitle.[Date Borrowed], tblauthortitle.[Return Date], tblauthortitle.Lender, IIf([Date Borrowed]="Date","Unavailable","Available") AS Status
    FROM tblauthortitle;

    Thank You.
    Gus

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Status: IIf([Date Borrowed]=Date(),"Unavailable","Available")

    would be the way to use it. But what about tomorrow? If the date borrowed doesn't equal the current date then it would say available when it was really unavailable. You should probably be using RETURN DATE instead:

    Status: IIf(IsNull([Return Date]),"Unavailable","Available")

  3. #3
    Gus is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2008
    Location
    Glasgow Scotland
    Posts
    6

    IIF Function

    Hi Bob,
    Second suggestion Status: IIf(IsNull([Return Date]),"Unavailable","Available") works a treat, just reversed Unavailable and available to get desired result. Im a Daycare officer trying to design a library Database for the Centre in my spare time. i will definitely require your help, if thats ok in the future make that near future.

    Kind Regards.
    Gus

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

Similar Threads

  1. Now() function
    By shexe in forum Queries
    Replies: 1
    Last Post: 11-11-2010, 09:59 AM
  2. if function
    By lolo in forum Queries
    Replies: 1
    Last Post: 08-01-2010, 11:38 PM
  3. Help with AVG function
    By techexpressinc in forum Reports
    Replies: 1
    Last Post: 03-23-2010, 07:47 AM
  4. Want function to get current function name
    By Davis DeBard in forum Programming
    Replies: 2
    Last Post: 08-13-2009, 05:02 AM
  5. Is there a function to do this....
    By Nowherefast in forum Access
    Replies: 2
    Last Post: 12-31-2008, 08:08 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