Results 1 to 6 of 6
  1. #1
    matteozz is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2015
    Posts
    9

    Select the larger of two values in a query

    Hello everyone!
    I created a table with numerical values: length, width, height, weight. Then I created a query in which I entered the fields mentioned above and then, in a new field of the query I put a formula to find a specific data TOT CUBIC METERS: (([SIZE]! [LENGTH] * [SIZE]! [WIDTH] * [SIZE]! [HEIGHT]) / 1000000) * 250.


    This formula works by filling in the fields Length, width, height. Now, however, I would make sure that the number derived from the expression is placed in relation to the weight of the table DIMENSIONS field and I return the greater of the two.

    I do not know where to turn !!
    Thanks for your help

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I'm guessing SIZE is a table name. You should look into access nominclature; like tables start w T....tSize It helps debugging.

    METERS: (([LENGTH] * [WIDTH] * [HEIGHT]) / 1000000) * 250.

    This should give the correct answer. But I;m not sure what you're asking to return.

  3. #3
    matteozz is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2015
    Posts
    9
    Thanks for your reply!
    The result from the expression that I made is correct. Now I need to use this result and compare it to another number and I want that appears the largest one. I also precise thet the place of these two numers can change: maybe the largest is the number from the expression or vice versa. I tried this 0.5*((A+B)+abs(A-B)) but it found only one of the two numbers...

  4. #4
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    try

    iif(A>B,A,B)

  5. #5
    matteozz is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2015
    Posts
    9
    Quote Originally Posted by Ajax View Post
    try

    iif(A>B,A,B)
    I think that I solved it using this formule:

    0.5*((A+B)+abs(A-B))

    What do you think about it?
    Thanks

  6. #6
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    yes that seems to work, interesting alternative way - I've learned something new today!

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

Similar Threads

  1. Where Condition larger than 255
    By intrepid in forum Access
    Replies: 7
    Last Post: 02-28-2015, 02:44 PM
  2. Replies: 3
    Last Post: 02-10-2015, 07:01 PM
  3. Replies: 8
    Last Post: 03-28-2014, 12:04 AM
  4. Replies: 9
    Last Post: 07-24-2013, 02:56 PM
  5. Replies: 3
    Last Post: 01-04-2011, 07:06 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