Turn on thread page Beta

Microsoft Access Help watch

Announcements
    • Thread Starter
    Offline

    0
    ReputationRep:
    Hi

    Im trying to have an If formula for multiple things in it for my as level ICT coursework and having trouble

    This is what I've got and its not working!

    Expr1: IIf([No Fine Practice]![Days Overdue]<7,"0.00"+IIf([No Fine Practice]![Days Overdue]>6<15,"0.30"))

    The first bit is fine with all number less than 7 returning the value 0.00

    The problem is with the second bit as its meant to be more than 6 and less than 15 to returrn 0.30

    This is where it goes horribly wrong because when I run the query it finishes with 0.000.30 on the parts that were originally 0.00

    Do I have to do separate queries each time?

    Thanks for your help in advance

    Alex
    Offline

    0
    ReputationRep:
    Its All Wrong!
    • Very Important Poster
    • PS Reviewer
    Offline

    21
    ReputationRep:
    Very Important Poster
    PS Reviewer
    (Original post by Alex H)
    Expr1: IIf([No Fine Practice]![Days Overdue]<7,"0.00"+IIf([No Fine Practice]![Days Overdue]>6<15,"0.30"))

    The first bit is fine with all number less than 7 returning the value 0.00

    The problem is with the second bit as its meant to be more than 6 and less than 15 to returrn 0.30

    This is where it goes horribly wrong because when I run the query it finishes with 0.000.30 on the parts that were originally 0.00
    Try rephrasing it in the format
    if(expr, 0.00, if((expr and expr),0.30,ERROR))

    ie
    IIf([No Fine Practice]![Days Overdue]<7,"0.00",((IIf([No Fine Practice]![Days Overdue]>6 and IIf([No Fine Practice]![Days Overdue]<15),"0.30","ERROR"))
    Offline

    1
    ReputationRep:
    to the best of my knowledge iif uses three parameters. Something in the query? if not, use VBA. A lot clearer than expressions.
 
 
 
Poll
Could you cope without Wifi?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.