Results 1 to 2 of 2
  1. #1
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121

    form to run query with combo boxes not returning expected results

    I stripped down the attached dbase to get help with form/query/combo boxes. I would expect to see Pay Date for each combination of Period From and Period To dates selected on the Form. I know I am missing something.
    Example, Selecting period from 8/24/19 to Period to 10/11/19 should return:
    Period From Period To Pay Date
    8/24/2019 8/30/2019 9/6/2019
    8/31/2019 9/6/2019 9/20/2019
    9/7/2019 9/13/2019 9/20/2019
    9/14/2019 9/20/2019 10/4/2019
    9/21/2019 9/27/2019 10/4/2019
    9/28/2019 10/4/2019 10/18/2019
    10/5/2019 10/11/2019 10/18/2019

    Attached Files Attached Files

  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,926
    First, criteria must reference combobox names, not field names - why have form bound to table when records are not even displayed

    Second, think need criteria only on one field

    Third, life will be a whole lot simpler if did not have spaces in naming convention.

    I am able to get criteria to work with literal dates (WHERE [Period From] BETWEEN #8/24/2029# AND #10/11/2019#) but substituting with comboboxes fails because of the ID field. Remove this from combobox RowSource.

    Consider this for query (need a better name) SQL:
    SELECT [Time Periods].[Period From], [Time Periods].[Period To], [Time Periods].[Pay Date]
    FROM [Time Periods]
    WHERE ((([Time Periods].[Period From]) Between [Forms]![Time Periods Selector]![CboPeriodFrom] And [Forms]![Time Periods Selector]![CboPeriodTo]));


    I never use dynamic parameterized query. I prefer VBA to build filter string and apply to form or report.
    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. query not getting expected results
    By slimjen in forum Queries
    Replies: 15
    Last Post: 10-29-2014, 11:29 PM
  2. Replies: 4
    Last Post: 06-12-2014, 07:01 AM
  3. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  4. Query not returning expected results
    By MarcieFess in forum Queries
    Replies: 3
    Last Post: 10-18-2013, 05:28 PM
  5. Query not returning all expected results
    By amenitytrust in forum Queries
    Replies: 6
    Last Post: 11-05-2012, 07:13 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