Results 1 to 7 of 7
  1. #1
    desnyder is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2020
    Location
    Oregon
    Posts
    19

    Query to pull a infor from a combo box and if not selected pull all records

    I am a real rookie, so I was not sure how to word the Title

    I want to run a report and be able to select the status of employees or if need run the report to show All Records.
    I have been trying a combo box (and list box), I don't know how to select all records if I don't want to filter for "Active" or "Inactive"


    I have found many different articles on it, but they all assume I understand SQL or VBA, I am not totally useless, but I need some basics.

  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,902
    Are you using a dynamic parameter query?

    SELECT * FROM table WHERE field LIKE [input here] & "*";

    [input here] can be reference to combobox or textbox.

    SELECT * FROM table WHERE field LIKE Forms!formname.comboboxname & "*";

    Or use VBA, review http://allenbrowne.com/ser-62.html
    Last edited by June7; 10-07-2020 at 04:42 PM.
    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
    desnyder is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2020
    Location
    Oregon
    Posts
    19
    June7 - I wish I knew what a dynamic parameter query was - If I did I probably could figure this out. I know how to add the combo box and tell it to look for the "Active" or "Inactive" and that works fine, just don't know what to modify the Combo box to tell it to show me all records if I don't select either option. Sorry, but as I said on my intro, I am new to databases

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Dynamic parameter query is a query that has variable input either by prompting user for input, as shown in my example with [input here], or by referencing a control on form, as shown in second example. As opposed to static criteria like: SELECT * FROM table WHERE field = "Active";


    Did you try either? This is really quite basic Access functionality. Have you studied an introductory tutorial book?
    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.

  5. #5
    desnyder is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2020
    Location
    Oregon
    Posts
    19
    June7 - Thank you
    I appreciate you at lest responding, I will try to get this figured out.
    No I have not studied a tutorial book, I am retired from the Military and have a civilian job now and trying to build a database to help me and my team with some things. I have little experience or knowledge, I didn't know I was expected to have any level of understanding to post questions, I will figure it out on my own.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Well, I would hope you have some understanding of basics of relational database concepts and Access functionality. You could really benefit from a solid week with a tutorial. Are you familiar with Access query designer? The SQL statements I showed can be built with the designer.
    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.

  7. #7
    desnyder is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2020
    Location
    Oregon
    Posts
    19
    June7 -
    Once again, thanks for taking the time to respond.
    I was able to manipulate the default query SQL with your suggestion and It appears to be working.

    SELECT [HR Report Employee Master].LastName, [HR Report Employee Master].CurrentStatusDescription, [HR Report Employee Master].HireDate
    FROM [HR Report Employee Master]
    WHERE ((([HR Report Employee Master].CurrentStatusDescription) Like [Forms]![frm_EmployeeDetails]![ComboStatus] & "*") AND (([HR Report Employee Master].HireDate) Between [forms]![frm_EmployeeDetails]![StartDate] And [forms]![frm_EmployeeDetails]![EndDate]));

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

Similar Threads

  1. Query to Pull all the records
    By Shamli in forum Access
    Replies: 9
    Last Post: 08-14-2018, 04:48 PM
  2. Query doesn't pull all records
    By tbjmobile@gmail.com in forum Queries
    Replies: 13
    Last Post: 02-24-2018, 05:53 AM
  3. Replies: 1
    Last Post: 04-10-2014, 12:55 PM
  4. Need to pull address from first record selected
    By tanyapeila in forum Queries
    Replies: 7
    Last Post: 03-17-2014, 02:55 PM
  5. Replies: 2
    Last Post: 05-08-2013, 03:37 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