Results 1 to 4 of 4
  1. #1
    jparker1954 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    85

    Question Just trying to insert a number in a formula automatically

    I have the following formula in a Report. When I originally set it up, I did not think that the numbers used as multipliers would change. The 42, 35, 20, 28 listed in this formula refer to weights of containers. Now my boss has decided he need to change the weights on a periodic basis to correspond to seasonal changes.



    =Sum(Round((([HarvestingLogQuery]![TotalSumOfGRPCs])*42)+(([HarvestingLogQuery]![TotalSumOfUgRPCs])*42)+(([HarvestingLogQuery]![TotalSumOfRdRPCs])*35)+(([HarvestingLogQuery]![TotalSumOfTubs])*20)+(([HarvestingLogQuery]![TotalSumOfSqRPCs])*28)+(([HarvestingLogQuery]![TotalSumOfZuRPCs])*28)+(([HarvestingLogQuery]![TotalSumOfCuRPCs])*28)+(([HarvestingLogQuery]![TotalSumOfBins])*1000)+([HarvestingLogQuery]![TotalSumOfLBS]),2))

    Right now, I'm just going into the report formulas and changing the numbers manually. But there are 6 similar formulas in my report, and changing them manually is tedious and subject to error.

    The report is based on the Harvesting Log Query, but I really don't care if the numbers match up or are related to that query or not. They are just multipliers I want to use. I set up a small table that lists the parameters and set up queries that will identify the latest line entered as the one to select a value from. That all works fine. Copy of Query info is below:
    ID Date GRPCS UgRPCS RdRPCS CuRPCS SqRPCS ZuRPCS Tubs Bins
    4 7/11/2013 42 42 35 28 28 28 20 1000

    Instead of the number 42 in the formula below, I like something like [LastRPCWeightsInfoQuery]![GRPCS] to replace the number so that each time the weights are updated, they automatically populate the formula. Unfortunately when I try to enter it into the Report that way, I get a message asking me to enter a Parameter for [LastRPCWeightsInfoQuery]![GRPCS]. How can I get around that? Is there a way to introduce a Query into the formula without have it be directly joined or connected to the HarvestingLogQuery?

    What am I doing wrong and how can I fix it? I'm working with almost 7000 records so don't want to go back and redo the original table or queries if I don't have to.

    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,641
    If the table/query only has 1 record, you can include it in the report's source query without a join and it shouldn't affect the results. That will enable you to refer to those fields in your formulas.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jparker1954 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    85
    That did the trick! Thanks!





    Quote Originally Posted by pbaldy View Post
    If the table/query only has 1 record, you can include it in the report's source query without a join and it shouldn't affect the results. That will enable you to refer to those fields in your formulas.

  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,641
    Happy to help!
    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: 12-11-2012, 12:01 AM
  2. Formula to assign a number to a field value?
    By dashingirish in forum Queries
    Replies: 2
    Last Post: 02-23-2012, 01:21 PM
  3. Replies: 4
    Last Post: 12-02-2011, 06:52 PM
  4. Replies: 4
    Last Post: 08-01-2011, 03:36 PM
  5. Insert x number of rows based on value
    By opopanax666 in forum Programming
    Replies: 4
    Last Post: 10-26-2010, 03:26 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