Results 1 to 4 of 4
  1. #1
    alcorp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    12

    How to use two different formulas in a query depending on one value

    Hi!



    Okay i queried my results and I think I got what I need.

    The next step is to process the info so I can display the results. I am trying to use the expression builder but I am getting stuck. (if there are any other ways, I am open to them)


    So basically in a column I have value that is either a 'Y' or 'N'. From these values I have to create a ten digit number called an APN. I need it to where If the the value is a 'N' that the formula will concatenate a '9' then the numbers I have in another column called the UCN (which have 4 digits and some are leading with 0's) and then concatenate '00001' at the end. The result will look similar to--->9083400001 or 9892400001

    For the 'Y' value I need to concatenate the '9' with the UCN (same as the other one) and then I have to concatenate with another column called the tax rate area. The result will have ten digits similar to ----> 9424112625 or 9082306987

    So basically the results will look like this

    APN____________TAXFEE
    9048200001______328.95
    9524855721______52.36


    And finally I have to create another column value called TaxFee which the product of the EDU column with the number 23.

    Anything helps, thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Confused, but check out the IIf() function:

    IIf(FieldName = "Y", OneCalculation, OtherCalculation)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    alcorp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    12
    Quote Originally Posted by pbaldy View Post
    Confused, but check out the IIf() function:

    IIf(FieldName = "Y", OneCalculation, OtherCalculation)
    Would it be better to use the formula in the SQL view?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Better than what? You can do it in SQL view or design view, if that's what you mean.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 08-31-2012, 04:41 AM
  2. Replies: 7
    Last Post: 08-02-2012, 07:31 AM
  3. Using totals in formulas in a query
    By dougie in forum Access
    Replies: 3
    Last Post: 07-02-2012, 11:54 PM
  4. Query Formulas
    By ShadeRF in forum Queries
    Replies: 8
    Last Post: 12-13-2011, 05:34 AM
  5. Query Formulas
    By ShadeRF in forum Queries
    Replies: 6
    Last Post: 11-15-2011, 10:45 AM

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