Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If condition in a query (Access 2000)

    On the basis of the fields present in the query i want to make the NetPrice with the If condition like that:

    If [crates] > 0 NetPrice = (UnitPrice * crates * pack)
    If [crates] = 0 NetPrice = (Bottles * UnitPrice)

    Can you help me build this field in the query ?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: If condition in a query (Access 2000)

    The expression would be something like this:

    NetPrice: IIf([Crates]>0,UnitPrice * crates * pack, IIf([crates]=0, Bottles * UnitPrice,0))

    The above translates to your conditions or returns a 0 if crates should be a negative number for some reason.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If condition in a query (Access 2000)

    Dear Charlotte,

    Thank you for the nice suggestion. it runs smoothly now and the query is excellent.

Posting Permissions

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