Results 1 to 3 of 3
  1. #1
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58

    Using Between and a Parameter in a query

    Hi, I have a basic table and I would like to have a parameter query based on a field to get data equal to or between to parameters.
    I have tried several inputs into the query but it only reports the first parameter. below is the criteria. Can I use parameters with between or = < >?

    Between [Enter State] And [Enter State] The field has ACT, NSW, TAS, SA, QLD, VIC, WA as the data.



    If I enter NSW as the first parameter and enter the query instantly runs and there is no second parameter

    Thank you in advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That really is only one input parameter because they are the same text. Change one or both, like:

    BETWEEN [start] AND [end]

    If you enter ACT and QLD you will get ACT, NSW, QLD. Is that what you would expect?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    between using States, may only work alphabetically. Between ACT & BOB should only result in ACT.

    if you want random states, use a tPicklist table for user to dbl-click a list of states, and it adds them to table tPicklist.
    join your table to tPicklist to get only those states in the result.

    using a form, you can use dates in a query like:
    select * from table where [dateFld] between forms!fMyForm!txtStartDate and between forms!fMyForm!txtEndDate

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

Similar Threads

  1. Replies: 6
    Last Post: 08-21-2019, 01:47 PM
  2. Replies: 2
    Last Post: 01-26-2017, 08:19 AM
  3. Replies: 1
    Last Post: 07-21-2015, 03:38 PM
  4. Replies: 1
    Last Post: 02-28-2013, 01:20 PM
  5. Replies: 13
    Last Post: 01-10-2012, 09:56 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