Results 1 to 3 of 3
  1. #1
    Lluewhyn is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jul 2016
    Posts
    11

    Query ignoring criteria ONLY with parameters


    I have a query that is calculating results as a percentage. Each record is a combination of different components, and the query calculates what percentage each component is of the total (there's even a sanity check at the end that adds all components up and divides by actual Total record to ensure 100%).

    So far, so good. Now, the purpose for the query is to search for records that may have values higher than certain values. The parameter works if I hard-key it in the Design View, but not if I put a Parameter to prompt the User for the value! For simplicity, I am troubleshooting with the format of decimals as opposed to percentages.

    Example
    Criteria = >.2 --->This is executing successfully and only pulling up those records where that component is greater than 20% of the total.

    Criteria = >[Enter Component Minimum %] (I enter ".2") --->This pulls up every record, even ones where value is lower than 20%.

    Any ideas?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    just to clarify, do you actually enter ".2" or .2?

    try entering 0.2

    the query may be interpreting your input as a string so try entering 0.2

    also try modifying your criteria to

    Criteria = >CDbl([Enter Component Minimum %])

    but wouldn't it be more natural to enter 20 when asked for a percentage? so criteria would be

    Criteria = >CDbl([Enter Component Minimum %]/100)

  3. #3
    Lluewhyn is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jul 2016
    Posts
    11
    I was using quotations only for clarification. However, your solution for the CDbl seems to work. Thanks!

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

Similar Threads

  1. Replies: 7
    Last Post: 05-27-2015, 12:45 PM
  2. Replies: 1
    Last Post: 07-03-2013, 10:39 AM
  3. Replies: 11
    Last Post: 11-09-2012, 08:17 AM
  4. Count Query w/o ignoring Nulls
    By Dulanic in forum Queries
    Replies: 3
    Last Post: 03-21-2012, 11:56 AM
  5. Crosstab Criteria or Parameters
    By lukewarmbeer in forum Access
    Replies: 3
    Last Post: 08-11-2010, 09:57 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