Results 1 to 6 of 6
  1. #1
    ultrarunner2017 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    44

    Query with user input and sort by multiple fields

    Hi;
    I have been pulling my hair out trying to figure out why I cannot create a simple query in Access 2010.
    What I need to do is ask the user for input to one field. I do that by using Like "*" & [Enter the data] & "*"
    Then I need to sort the results. That works fine so long as I sort only by one field (column in the design view).
    But when I try to sort by more than one field, the user is asked multiple times to enter the search criteria (number of times asked is the number of fields which have a sort criteria).
    If I do not ask the user for input, the query runs fine no matter how many fields it is sorted on.

    this also happens if I run a query which is not sorted, but do a sort while viewing the query - then save the query when closing it. Even though the new sort criteria does not show up in the design view, it acts the same way as it would if I had entered it there.



    I have read several articles on doing query sorts by multiple columns, and they talk about selecting the sort criteria in the "criteria pane". Since I cannot find anything on the Design Tools ribbon called "criteria", I am assuming that criteria is the large pane that is always opened in the main window of the design view.
    If not, I really need to go back and study the multiple e-books I have for Access 2010.

    In the end, I probably should not be using Queries like this. I should be creating forms, reports, etc. But since this database is really for my use only, I haven't bothered with that.

    Thanks for your help
    FW

  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,870
    You haven't told readers anything about your database, nor requirements. I recommend you do a little research on database concepts and design.
    Here is a link with lots of info on database planning and design.

    Good luck.

  3. #3
    ultrarunner2017 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    44
    This pretty much describes the problem I am having.
    https://stackoverflow.com/questions/...meter-and-sort
    Yes, I agree that I need to do some research and reading.

  4. #4
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I've never heard of this, nor experienced it, and I can't replicate it now. If I sort on a field with multiple variations of "shear***" and prompt for the criteria value, it runs fine with our without a sort. Did you try a compact/repair on your db? If that's of no help, I'd copy the sql from your query sql view and paste it into a new one and save it, then run it. See if the current query is corrupt.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    @ultrarunner
    I'd never heard of the issue either and have just tested repeatedly.
    After endless attempts which worked perfectly I finally managed to get it to do what you said - parameter request appeared twice.
    Ran it a second time & it did it again.
    Decided to save it so I could post the situation that triggered this behaviour.
    I then ran it again - it behaved perfectly

    Since then I've tried repeated variations on this using different fields, sorts, tables & can't get it to go wrong again.
    So as Micron has already suggested, I think you may have corruption
    Last edited by isladogs; 12-23-2017 at 05:20 PM. Reason: typo

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    For your sole use or not, really could save yourself a lot of aggravation and frustration by not using popup input prompt. Just cannot validate input. Not that much effort to build a 'search' form. Instead of the generic prompt in the query, just reference control on the form, possibly a combobox LimitToList Yes so only valid data can be selected.
    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.

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

Similar Threads

  1. Replies: 1
    Last Post: 05-29-2017, 05:21 AM
  2. Sort across Multiple Fields DCount help
    By kywilson25 in forum Queries
    Replies: 3
    Last Post: 02-19-2017, 07:29 PM
  3. Replies: 15
    Last Post: 11-26-2015, 11:27 AM
  4. Replies: 4
    Last Post: 06-02-2015, 08:30 PM
  5. Input Forms - How To Input Multiple Fields/Records?
    By butterbescotch in forum Forms
    Replies: 1
    Last Post: 04-04-2013, 06:30 AM

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