Open form and filter by date range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gdyoung
    New Member
    • Nov 2011
    • 1

    Open form and filter by date range

    I'm building a database and am having troubles opening a form with a filter.

    I've tried a few things but nothing seems to be doing what I want.

    Here's a stop gap solution that at least displays records but with the annoying popup:

    Code:
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    StDocName = "HHI Register"
    
    StLinkCriteria = "[Media Date Range Start] = [Enter Date ie 09-Nov-11]"
    DoCmd.OpenForm stDocName,,,stLinkCriteria
    DoCmd.Close acForm, "Front Page"

    This is only giving me a result for a single date of course.

    What I want is to return a date range from the table "HHI Register" by using 2 text boxes with calender called "TxtDateSta rt" and "TxtDateEnd "

    I tried:

    Code:
    stLinkCriteria between #" & Format(Me.TxtDateStart, "dd-mmm-yy") & "# AND #" & Format(Me.TxtDateEnd, "dd-mmm-yy") & "#"
    No Luck.

    Any one want to put me back on the straight and narrow.

    Guy
    Last edited by NeoPa; Nov 30 '11, 02:41 AM. Reason: Added mandatory [CODE] tags for you
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32634

    #2
    Try for line #6 something like :
    Code:
    StLinkCriteria = "[Media Date Range Start] Between [Enter StartDate] And [Enter EndDate]"

    Comment

    Working...