Results 1 to 7 of 7
  1. #1
    Stylianos is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    9

    Desperately need help with Select Date criteria in Form:

    Hello, I am still very new to Access and have an issue that surfaced after importing data from another database. I have 2 criteria to a query to add “Search by Date” and “Search by Date Range” with the control on a form “frmProductionReports”. The Search by Date Range works great but the Search by Date yields no results. When I set up the tables and queries, I did not specify any format criteria but the data I imported to the tables was set to “general” format, thereby giving me Date and Time. The text buttons on the Form were originally set to “Short Date” which worked fine with the dummy data I added during the build stage. Now that I added official data… the problem surfaced! Is there a method to either fix or work around this issue?
    Form (frmProductionReports)


    Between [Forms]![frmProductionReports]![txtStrtDateSum] And [Forms]![frmProductionReports]![txtEndDateSum] Or [Forms]![frmProductionReports]![txtDateSum]
    To run the query, I have set a command button (ProductionResultsSummary) with a macro “On Click” as follows:







    Query: qryUnionQryProdDataSummary (pulled from a union query)

  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,963
    Really need to see data. If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Stylianos is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    9
    Hello June7! I will check with my manager if I can release the db...
    Thank you!

  4. #4
    Join Date
    Apr 2017
    Posts
    1,687
    It looks like you have date AND time in field. Instead equals try
    Code:
    Form (frmProductionReports)>= [Forms]![frmProductionReports]![txtDateSum] AND < [Forms]![frmProductionReports]![txtDateSum]+1
    And probably you have some records left out when you use BETWEEN too. Instead use
    Code:
    (frmProductionReports) >= [Forms]![frmProductionReports]![txtStrtDateSum] And < [Forms]![frmProductionReports]![txtEndDateSum]+1

  5. #5
    Stylianos is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    9

    Select by Date/Select by Date Range Filter for Query

    Quote Originally Posted by ArviLaanemets View Post
    It looks like you have date AND time in field. Instead equals try
    Code:
    Form (frmProductionReports)>= [Forms]![frmProductionReports]![txtDateSum] AND < [Forms]![frmProductionReports]![txtDateSum]+1
    And probably you have some records left out when you use BETWEEN too. Instead use
    Code:
    (frmProductionReports) >= [Forms]![frmProductionReports]![txtStrtDateSum] And < [Forms]![frmProductionReports]![txtEndDateSum]+1

    Hello ArvilLaanemets!
    It was a good start, I undated the query criteria. run the macro to filter the data and create the report and was able to pull all data regardless of format. The problem though is that it pulled ALL the data for both Select Date and Select by Date Range options. I noticed that it split the criteria into 2 separate fields when I saved but wasn't sure why. (see attached) Did I go wrong somewhere?
    Attached Thumbnails Attached Thumbnails LatestAttempt.PNG  

  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,963
    WHERE CompletionDate BETWEEN [Forms]![frmProductionReports]![txtStrtDateSum] AND [Forms]![frmProductionReports]![txtEndDateSum] +1

    or

    WHERE CompletionDate >=[Forms]![frmProductionReports]![txtStrtDateSum] AND CompletionDate < [Forms]![frmProductionReports]![txtEndDateSum] +1
    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
    Stylianos is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2018
    Posts
    9
    Thank you very much ArvilLaanemets and June7~ I Tweeked it a bit but now all cmd functions are working! Much appreciated

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

Similar Threads

  1. Replies: 4
    Last Post: 09-23-2014, 08:39 AM
  2. Replies: 12
    Last Post: 06-12-2014, 07:37 AM
  3. Using a form as a criteria in a select query
    By rateri22 in forum Queries
    Replies: 14
    Last Post: 08-02-2012, 08:41 AM
  4. Replies: 18
    Last Post: 07-18-2012, 01:08 PM
  5. Replies: 1
    Last Post: 05-18-2011, 12:23 PM

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