Results 1 to 4 of 4
  1. #1
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113

    Search form to select specific fields from a query

    Ideally what I am trying to accomplish is the following: I have a query that shows all the product information. ProductName, Description, Price, Quantity in stock, Supplier etc... Now I am making a search form that contains unbound controls for each field which are then used as criteria in the query. So now if I select a product it displays all the information for that product. But now I want to filter that result. For example if I am only interested in displaying the product name and Price and hide all the other fields because I am making a Price List. Or I just want to see the Supplier and their products and Hide all the other fields. I know that I could make different queries for each situation, but then I windup with a 100 queries... So in conclusion what I want is to be able to show and hide the fields from the query depending on what the user wants to find. Is this possible, and if so how do I do it... Thank you for your help

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Have you analyzed your requirements? I think you may have some different queries but not nearly 100.
    Perhaps you could tell us more about your database, the tables and relationships involved.

    Sounds like you could have a form with some buttons to run queries/reports based on some user selected choices.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Display of fields in query cannot be dynamic - at least not without VBA code that modifies QueryDefs. Strongly advise against this as this is programmatic db design modification.

    Build reports.
    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.

  4. #4
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113
    Thank you both for your suggestions. June7 you are right it requires VBA code. I found the answer and that is making check boxes and then have the VBA write the SQL statement taking in consideration the fields that the user has selected before firing the Query. In that way the user is making the queries without knowing.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-08-2015, 01:47 PM
  2. Replies: 1
    Last Post: 10-29-2014, 10:23 AM
  3. Select all query fields for main form?
    By tagteam in forum Access
    Replies: 13
    Last Post: 09-15-2013, 04:35 PM
  4. SELECT a specific DATE RANGE in Query
    By taimysho0 in forum Queries
    Replies: 28
    Last Post: 06-04-2012, 04:58 PM
  5. Sub form based on table select specific records
    By ReluctantGeek in forum Forms
    Replies: 0
    Last Post: 01-21-2012, 11:24 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