Results 1 to 6 of 6
  1. #1
    BDibz is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2018
    Posts
    62

    Question Why is query asking for an input parameter that is redundant

    I am trying to do an inventory system, where the current inventory is calculated by a sum of in/out transactions for that part as "ElectrodeQty", and then based on the job forecast for the next month, the gap between current inventory and inventory needed is calculated with "ElectrodesNeeded". Right now, the query does work; however, it asks for an input parameter "ElectrodeQty" even though that is a variable present in the query itself. Any ideas why this may be?




    Code:
    ElectrodeQty: Sum(([Qty In]-[Qty Out]))
    Code:
    ElectrodesNeeded: Round(([partQty]/[partsPerElectrode])-[ElectrodeQty])
    Click image for larger version. 

Name:	Query.PNG 
Views:	12 
Size:	25.9 KB 
ID:	33215

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Could be you have to do the Sum of transactions first.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Your expression uses ElectrodeQty which is a calculated field from the query - therefore it needs to reference the query parameter [Forecast Month]
    But that parameter is incorrect as the field name has no space.
    Its also unnecessary - you are grouping by that field - remove the parameter
    Are you sure you need to group by that field at all as you aren't showing it
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    BDibz is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2018
    Posts
    62
    Quote Originally Posted by ridders52 View Post
    Your expression uses ElectrodeQty which is a calculated field from the query - therefore it needs to reference the query parameter [Forecast Month]
    But that parameter is incorrect as the field name has no space.
    Its also unnecessary - you are grouping by that field - remove the parameter
    Are you sure you need to group by that field at all as you aren't showing it
    I don't quite understand. I'm using Forecast Month field to select a month from the Jobs table so that it only displays results from that month. What it says in brackets is just what the user input box prompts for, then it looks up that month in the Jobs table and returns those. How is this related to ElectrodeQty?

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Quote Originally Posted by BDibz View Post
    I don't quite understand. I'm using Forecast Month field to select a month from the Jobs table so that it only displays results from that month. What it says in brackets is just what the user input box prompts for, then it looks up that month in the Jobs table and returns those. How is this related to ElectrodeQty?
    Sorry - my previous reply was nonsense - ignore what I wrote before

    You have 2 expressions - one dependent on the other
    Code:
    ElectrodeQty: Sum(([Qty In]-[Qty Out]))
    Code:
    ElectrodesNeeded: Round(([partQty]/[partsPerElectrode])-[ElectrodeQty])

    Access can't do the second expression as the value for the first part hasn't been set

    The first has too many brackets though it will work. This is better
    Code:
    ElectrodeQty: Sum([Qty In]-[Qty Out])
    Rewrite the second expression replacing ElectrodeQty with the expression used to calculate it
    Code:
    ElectrodesNeeded: Round(([partQty]/[partsPerElectrode])-Sum([Qty In]-[Qty Out]))
    Alternatively, do one query to calculate ElectrodeQty then another query to get ElectrodesNeeded
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    BDibz is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2018
    Posts
    62
    Thank you, that makes much more sense. I assumed it would calculate values sequentially and store them before calculating the next.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-14-2016, 04:22 PM
  2. Replies: 15
    Last Post: 11-26-2015, 11:27 AM
  3. Input Parameter Not Working
    By cc143most in forum Queries
    Replies: 2
    Last Post: 08-21-2012, 07:37 AM
  4. Replies: 2
    Last Post: 01-27-2012, 09:49 PM
  5. Display Query Value That Requires Input Parameter
    By Access::Student in forum Access
    Replies: 1
    Last Post: 05-29-2009, 08:43 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