Filtering a Subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cwby1966
    New Member
    • Feb 2007
    • 49

    Filtering a Subform

    Hi
    I have a main form with a subform. The mainform has 2 textboxs Starting date and ending date. These are for the user to select a date range, and then clicka button to filter the subform to view only records that are in the date range. This DB is in Access 2007. I have tried appling filter with a saved query I have also tried the folloing code. Any ideas
    Thanks
    Code:
    Private Sub Command111_Click()
    Me!tbl_leasefllwup.Filter = "fllupdate = between me!start and me!end"
    Me!tbl_leasefllwup.FilterOn = True
    End Sub
  • rsmccli
    New Member
    • Jan 2008
    • 52

    #2
    Try something more like:
    Code:
    Me.Filter = "[fllupdate] Between #" & Me.Start & "# And #" & Me.End & "#"

    Good luck with your problem,
    rsmccli

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      Good advice, but the date values also aught to be formatted. See Literal DateTimes and Their Delimiters (#).

      Comment

      • cwby1966
        New Member
        • Feb 2007
        • 49

        #4
        Originally posted by NeoPa
        Good advice, but the date values also aught to be formatted. See Literal DateTimes and Their Delimiters (#).
        Thanks
        Works Perfect.
        Last edited by NeoPa; Aug 20 '08, 04:32 PM. Reason: Removed all caps

        Comment

        Working...