Results 1 to 6 of 6
  1. #1
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    Open Report Filter Stopped Working

    Hi I have upgraded to Access 2010 and have found a bit of a problem with the following. The Command Button filters according to a text box (text) and two text boxes (date) for start and finish dates
    The text filters but the date has no effect at all
    Yet in the report data tab - filter this is the result using the command btn
    [date_inc] Between #1/09/2011# AND #25/09/2011#
    And this is the result using on report built in filter selection "Dates Between"


    [date_inc] Between #9/1/2011# And #9/25/2011#
    just the US UK date format reversed which should not matter?

    Private Sub cmdFilter_Click()
    Dim strWhere
    If Not IsNull(Me.cboBranch) Then
    strWhere = strWhere & "[BranchName]='" & Me.cboBranch & "'"
    End If
    If Not IsNull(Me.txtStartDate) Then
    strWhere = strWhere & IIf(strWhere = "", "", " AND ") & "[date_inc] Between #" & Me.txtStartDate & "# AND #" & Me.txtEndDate & "#"
    End If
    DoCmd.OpenReport "rptIncListing2", acViewPreview, , strWhere
    End Sub

    any suggestions please

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link will help: http://allenbrowne.com/ser-36.html

  3. #3
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    Well sort of solved

    So to eliminate one factor I changed my local settings to US mm/dd/yyyy
    and what do you know my filter works. So this is my problem. Why did Access 2007 handle this? (does not matter I'm here now)

    So to fix this, is the code to concatenate the date to SQL the fix. And where does that go.
    What will this mean for a user
    A: whose local setting is mm/dd/yyyy
    B: whose local setting is dd/mm/yyyy
    ?
    thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the Calendar to select dates and then you are under control of the format.

  5. #5
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    getting there

    yes my two unbound boxes were date format short Date so the date picker was there and used. I will accept this code did work for me but now in Access 2010 it no longer does.
    I have now followed this
    http://www.everythingaccess.com/tuto...o-a-Date-Range
    it is an AllenBrowne code and hey it works
    so it's solved for now

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That's great! Thanks for posting back with your success and solution.

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

Similar Threads

  1. Access has stopped working
    By phillb in forum Forms
    Replies: 9
    Last Post: 01-10-2012, 12:22 PM
  2. Replies: 9
    Last Post: 11-22-2011, 05:23 PM
  3. Replies: 1
    Last Post: 08-01-2011, 04:17 PM
  4. Filter and Open Report in Runtime
    By ggs in forum Access
    Replies: 3
    Last Post: 06-28-2011, 03:02 AM
  5. All Buttons Stopped Working and...
    By rhoridge in forum Programming
    Replies: 1
    Last Post: 12-02-2010, 11:25 PM

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