Results 1 to 12 of 12
  1. #1
    Elwood07 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    26

    Filter Date in Subform based on Date Picker in Main form

    I'm going nuts here:



    I have a main form "SCParent" and 1 subform "SCSub"
    The main form has a combo box for outlets. User chooses the outlet name from the box and the subform displays all records from that outlet. Parent and Child is linked through the Outlet ID#. This part is working just fine.

    User needs to then choose a date on the main form using a date picker in a regular text box (which is set to default value today). I need the subform to display records from that outlet from that the date chosen.

    The date picker is labeled txtDateFilter and the date field in the subform is labeled txtTicketDate.
    I can't for the life of me figure this out, and think it should be pretty simple.

    The main table combo box pulls from "Outlet" table and the subform pulls from 3 different tables, all linked with working relationships. The txtTicketDate pulls from table "Ticket".

    Thanks in advance for your help!

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    try modifying your subform linkchild and linkmaster properties to include the date - i.e.

    child - [Outlet ID#], TicketDate
    master - [Outlet ID#], txtTicketDate


  3. #3
    Elwood07 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    26
    Quote Originally Posted by Ajax View Post
    try modifying your subform linkchild and linkmaster properties to include the date - i.e.

    child - [Outlet ID#], TicketDate
    master - [Outlet ID#], txtTicketDate


    Hi Thanks for responding, but the text box on the parent isn't linked to any field in the database. I tried what you said, but the drop down for the master doesn't have the date box listed; only the fields that are part of the Outlets table so i don't have a way of linking.

    Thanks

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If the textbox is unbound, you could apply the value of the unbound textbox to the subform's Filter property. Just be careful that the user does not accidently change the filteron property to = No. An alternative may be to affect change to the subform's RecordSource.

  5. #5
    Elwood07 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    26
    Thanks - I have no idea how to do what you're suggesting.
    I don't know how to set the filter property.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  7. #7
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    but the text box on the parent isn't linked to any field in the database.
    Rather than using the dropdown options, just type it into the properties

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Ajax View Post
    Rather than using the dropdown options, just type it into the properties
    Hmmm, never tried that one.

  9. #9
    Elwood07 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    26
    Quote Originally Posted by Ajax View Post
    Rather than using the dropdown options, just type it into the properties
    Tried that...i typed in txtDateFilter for the master link and I still get a pop up parameter box to enter in the date, like it's not reading the date I just chose in the box. The date box gives me the NAME error; the ticket date on the subform does filter, though, so it's a step in the right direction, but not quite right. Thanks.

    I started with google searches; I just don't know Access well enough to understand the jargon.

  10. #10
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    c...i typed in txtDateFilter for the master link
    previously you called it txtTicketDate

  11. #11
    Elwood07 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    26
    the text box in the master with the date picker that the user chooses is txtDateFilter and the field in the subform that needs to filter by that date is txtTicketDate.
    I put txtDateFilter in the Master link and txtTicketDate in the child link.

  12. #12
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    Sorry - missed that

    txtTicketDate in the child link
    are you really prequelling your field names with txt? or is this the name of the control? It needs to be the name of your field

    However also forgot that when using an unbound control for the master link, you need a bit of code in the current event or that controls after update event to requery the subform to update it, so since you need code, you might as well go the filter route

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

Similar Threads

  1. Filter main form based on subform data
    By Varda in forum Forms
    Replies: 9
    Last Post: 01-02-2015, 10:40 PM
  2. Replies: 2
    Last Post: 05-22-2014, 06:11 PM
  3. Subform Filter based on Main Form Information
    By james.carpenter2 in forum Forms
    Replies: 0
    Last Post: 02-16-2011, 09:55 PM
  4. Replies: 1
    Last Post: 11-16-2010, 08:42 AM

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