Results 1 to 8 of 8
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    Filtering in Forms

    Am I correct that in a Form you cannot filter a particular field, save & close the Form, & then reopen the Form as it was previous filtered, right? I have a Form in datasheet view being one of the fields contains the Mnthyr (Month/Year). I only want to see the current mnthyr records when I open the Form (which contains a sub-form within.) I’m trying to avoid A) having to filter this mnths records each time I open the Form & B) I really don’t want to create/save a new Form every month. Might anyone have any suggestions?
    Thanks in advance.

  2. #2
    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,850
    Dave,
    A bound form is associated with a table or query in that the "recordsource" of that form identifies the fields and values available to the form. When you open such a form again, as long as the recordsource of the form is the same, you should have the same data.

    The "recordsource" is basically the means by which data is made available to a Form. Could be a table, could be a query,or could be an SQL statement. When you filter a form, you are modifying the recordsource.

    Suppose you had a query - SELECT Name, address from PersonTable ---which would give you all the Names and addresses for all People in the PersonTable and it was the recordsource of a Form.

    If/when you filter that "data" to only have those people with names starting with "C" -- the query is modified as

    SELECT Name and Address from PersonTable WHERE Left(Name,1) = "C"

    So it's the data available to the form that is filtered.
    The data is not saved with a form. Data resides in tables. Tables can be viewed/seen by queries.

    Hope that helps

  3. #3
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Hey Orange, thanks for replying to me. Yea I hear what you're saying; unless I filtered out the current month in the query then that's pretty much my option.

  4. #4
    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,850
    You should really store dates as Date/Time datatype. Your mnthyr doesn't sound to be a Date datatype.

    What sort of data is in Mnthhyr?

    Could be something like

    Select all your current fields FROM Your Table
    where
    Month(MnthYr) = Month(Date) and
    Year(mnthYr) = Year (Date)

  5. #5
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    No Orange, my "mnthyr" is a Date/Time Datatype." I have the month & year combined, "mmyy" are you suggesting that I ought to have them separate (in 2-seperate Fields)?

  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,850

  7. #7
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Orange, the Mnthyr field it's not an entry.; it's derived from the "Date" entered. In the Date field: 3/21/2013. Then in the 'MnthYr' field is: 03/13.

  8. #8
    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,850
    If you derive MnthYr from some date, and you want only records from the current month and year, then
    my sql above should work IF you replace the MnthYr in the sql with the name of the field from which you derive MnthYr.
    Last edited by orange; 03-22-2013 at 07:30 AM. Reason: spelling

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

Similar Threads

  1. Filtering Forms
    By Lupson2011 in forum Forms
    Replies: 1
    Last Post: 02-07-2012, 04:48 PM
  2. Filtering forms by date
    By rwest in forum Forms
    Replies: 1
    Last Post: 01-03-2012, 11:23 AM
  3. Filtering Forms
    By Iggsy in forum Forms
    Replies: 6
    Last Post: 11-23-2011, 01:01 AM
  4. Access 2007 Filtering Forms
    By mab in forum Forms
    Replies: 2
    Last Post: 05-20-2011, 06:14 AM
  5. Combo Box Filtering between Forms
    By andrew_ww in forum Access
    Replies: 3
    Last Post: 12-30-2009, 11:06 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