Results 1 to 3 of 3
  1. #1
    Sing is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2019
    Posts
    2

    Lightbulb Parameterquery; how to use operators like > and <

    I've a in my database a simple table for ledlights. One of its fields is Type; another field is Power (W). The last field is a numeric field (integer).


    I made a parameterquery. In this query I noted behind Criteria: [Power?]. When I excecute the query I get the pop-up asking for Power? When I fill in 5 and OK I get what I want. A nice list with all 5-W ledlights. So far so good.
    However, when I fill in >5 and OK, the parameterquery doesn't work. In my language I get a message that this expression wasn't correctly typed or that this expression is too complex for evaluation. The helppage informs me with an errorpage 3071.
    What am I doeing wrong?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    you can't include the operator in the parameter in this way. Instead use the eval function in a new column e.g.

    which:Eval([Power (W)] & [Power?])

    and set the criteria to <>False. You don't need to see the column in the results to untick the show option.

    You will get errors if you try to enter a non numeric value.

    you can also enter more complex requirements such as

    'between 5 and 10'

    'like *5'

    Using this method is fine for development purposes, but I don't recommend it for a production application - use forms instead for the user to complete. Or allow users to use the right click menu which has similar functionality to the excel equivalent


    Also be aware that Type is a reserved word and should not be used as a field name, at some point down the line you will get misleading error messages - recommend change to something more meaningful such prodType. Similarly using non alphanumeric characters in field names will also cause problems down the line. See this link https://support.office.com/en-gb/art...9-f855bdd9c5a2

  3. #3
    Sing is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2019
    Posts
    2
    Excellent reply;thank you!
    Your bottomline note is understood.

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

Similar Threads

  1. Replies: 4
    Last Post: 09-07-2017, 12:01 PM
  2. Calculated Field with Appropriate Operators?
    By excellenthelp in forum Access
    Replies: 3
    Last Post: 07-02-2014, 08:27 AM
  3. IIF query using OR operators not working
    By Reigncloud in forum Queries
    Replies: 5
    Last Post: 02-16-2012, 04:02 PM
  4. List box with operators
    By akingsley in forum Programming
    Replies: 8
    Last Post: 11-06-2010, 05:59 PM
  5. Adding Mathematical Operators to my QBF
    By Silver Rain 007 in forum Queries
    Replies: 1
    Last Post: 11-05-2009, 08:54 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