Results 1 to 4 of 4
  1. #1
    Tony Davis is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    2

    Question on a formula. 10+ years since last used access, please help

    I have a field "Number1" and I need another field to check that value and return a different number(ex...if "Number1" is <=100 then $1.27, if "Number1" is between 101 and 200 then it returns $1.15, and so forth up to 1000.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Where exactly do you want to do this? Query? Form? Report?

    What is your database structure (tables and relationships)?
    Where does this requirement fit in your overall process?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Either
    1. I would do this as a function...
    build the code function in a module to return your value
    Code:
    Public Function CalcMyVal(ByVal pvNum)
    Select Case pvNum
       Case Is <= 100
          CalcMyVal = 1.27
       Case 101 To 200
          CalcMyVal = 1.15
       Case 201 To 300
          CalcMyVal = 1.05
    End Select
    End Function

    then put the function in a query..
    Select CalcMyVal ([NUMBER1]) as Expr1

    or
    2. build a table with the range [startVal] , [EndVal], [Amt]
    if the value is between the 2 fields, return the [amt]

  4. #4
    Tony Davis is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    2
    Quote Originally Posted by orange View Post
    Where exactly do you want to do this? Query? Form? Report?

    What is your database structure (tables and relationships)?
    Where does this requirement fit in your overall process?


    Been a long time since I messed with Access, so I am merely tinkering right now. Only working with a table at the moment. Trying to build a calculated field that can do it, somewhat of a =if formula. I could get it to do a simple one (=if([Number1]<=100, [Number1]*1.27...etc. But that seemed only good for 2 choices (true,false) argument. I need it to go further for 6 different conditions.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-03-2012, 05:39 PM
  2. Design Question: Multiple years
    By dcfrancis in forum Database Design
    Replies: 4
    Last Post: 04-25-2012, 01:46 AM
  3. Field in query formula question
    By jcaptchaos2 in forum Access
    Replies: 7
    Last Post: 04-24-2011, 06:32 PM
  4. Sigh, having used Access in 5 years and stuck..
    By Access Denied in forum Access
    Replies: 3
    Last Post: 10-06-2009, 02:19 PM
  5. Formula question on Report
    By FestoAccessBuilder in forum Reports
    Replies: 0
    Last Post: 03-10-2009, 10:21 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