Results 1 to 4 of 4
  1. #1
    radian89 is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    Dec 2015
    Posts
    37

    Filter by Date from Mainform textbox Simple but Desperate trying code everywhere :(

    Hi All,

    I'm desperate searching and trying VBA code for filtering by Date. I have main form with 2 unbound textboxes, each is StartDate, and EndDate. the goal is to able search/filter based on start & end date. if there's no data in the textboxes it'll display all data.

    both StartDate & EndDate textbox is Unbound & formatted Short date and Show Date Picker = For Dates

    I've been lookin for allen-browne code but that's too confusing for me (newbie here).

    the form is name DailytransSummF. I'm attaching the database.
    Click image for larger version. 

Name:	Searchbydate.JPG 
Views:	14 
Size:	47.7 KB 
ID:	23146

    Thanks a lot for the help.
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    After you enter the dates,click the filter button,
    the code goes in btnFilter_click event,

    Code:
    me.filter = "[date] between " & txtDateStart & " and " & txtDateEnd
    me.filterOn = true

  3. #3
    radian89 is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    Dec 2015
    Posts
    37
    Quote Originally Posted by ranman256 View Post
    After you enter the dates,click the filter button,
    the code goes in btnFilter_click event,

    Code:
    me.filter = "[date] between " & txtDateStart & " and " & txtDateEnd
    me.filterOn = true
    Hi Ranman256,

    I intend to hide the filter button (or navigationbutton). so I only use command11 button to do the search.
    thanks for the help.

  4. #4
    radian89 is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    Dec 2015
    Posts
    37
    I've done it.
    the filter works, after googling.

    got the code from :
    http://www.access-programmers.co.uk/...d.php?t=278246

    thanks to Master VBALnet, and pds8475 to provide exactly like my situation

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

Similar Threads

  1. Replies: 9
    Last Post: 01-23-2015, 02:08 PM
  2. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  3. Simple Date Code >6 for dteentered field
    By burrina in forum Forms
    Replies: 5
    Last Post: 02-05-2013, 01:32 PM
  4. Replies: 3
    Last Post: 12-06-2011, 07:37 AM
  5. Filter a subform based on mainform
    By Cheshire101 in forum Queries
    Replies: 3
    Last Post: 01-06-2011, 12:56 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