Results 1 to 5 of 5
  1. #1
    statechamp171 is offline Novice
    Windows XP Access 2016
    Join Date
    Mar 2018
    Posts
    2

    expression - choose a larger field

    I am a newbie when i comes to ACCESS so bear with me. I want to make a field with an expression that chooses the larger value between 2 other fields. Example:



    Field: Bench Press 1 (BP1)

    Field: Bench Press 2 (BP2)

    Field: Bench Press 3 (BP3)

    Field: Bench Press Difference (BPD)

    So I want the expression to do the following: BPD = BP3 - (which ever is greater BP1 or BP2)

    I hope that makes sense: Please Help!!!

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Use an IIf statement

    Code:
    BPD=BP3-IIf(BP2>BP1,BP2,BP1)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    statechamp171 is offline Novice
    Windows XP Access 2016
    Join Date
    Mar 2018
    Posts
    2
    Worked liked a charm!!!! Thank You.

  4. #4
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You're welcome. Easier for me than doing bench presses.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Just so you are aware going forward - it's generally considered bad practice to store calculations or have calculated table fields. I can't tell where I want to make a field is supposed to exist, so forgive and ignore me for jumping in if it's only in a query, form or report that you're doing this.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 28
    Last Post: 02-06-2018, 11:47 AM
  2. How does Best Fit choose a field width?
    By hagamablabla in forum Access
    Replies: 4
    Last Post: 07-13-2017, 07:17 PM
  3. Extract Country Code from a larger field
    By wcrimi in forum Queries
    Replies: 9
    Last Post: 06-14-2015, 04:43 PM
  4. Replies: 3
    Last Post: 02-10-2015, 07:01 PM
  5. Can't Choose Field Properties on Query Fields
    By tylerpickering in forum Queries
    Replies: 5
    Last Post: 04-02-2014, 01:56 PM

Tags for this Thread

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