Results 1 to 6 of 6
  1. #1
    moss555 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    2

    Filtering a sub form.

    Hello I have a main form (unbound) called form1

    On form1 I have two subforms - subform1 and subform2

    I have a textbox on form1 (text1)



    I would like to apply a filter (filter1) to subform1
    and
    I would like to apply a filter (filter2) to subform2

    after text1 on the main form is updated.

    Please could someone give me a hand with this.

    I am just trying to learn code after relying on macros for years

    Many thanks

    Mark

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Why is the main form unbound? Could it have a RecordSource that would act as control for the subforms? Filter the main form and the subforms will synchronize. If you can't go that route then VBA would have to be in some event of the main form (a button click?). Then could use Filter and FilterOn properties of subforms to filter the data. I always give subform container control a name different from the form it holds, like ctrInvoiceDetail.

    Me.ctrInvoiceDetail.Form.FilterOn = False
    Me.ctrInvoice.Form.Filter = "InvoiceID = " & Me.InvoiceID
    Mr.ctrInvoice.Form.FilterOn = True
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    moss555 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    2
    The main form is unbound as I am writing a diary and wish to have two 'pages' on view at the same time - i thought two subforms would be handy for this. My workround so far is to set the recordsource of the sub forms to a query at the onopen event - which seems to work - but wonder if there is a better way?

    Thanks for your help thus far

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    So each subform is bound to the same source? You want the 'pages' side-by-side? What is the filter criteria? How do you move to next pair of pages? Still think could have the main form bound. However, either way some coding is required to filter recordset. Do you want to provide project for analysis (without diary entries of course)?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    If the main form is unbound but the two subforms are not, you can set a text box on the main form for the linking ID and when you select what you want from the main form, you have the text box update the ID and then, if the subforms are linked via the Master/Child links on that text box (for Master) and shared ID (for child) then once you make the selection the subforms should have the information automatically change in them, without code.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Ah! Thanks Bob for reminding me of this - and I just told someone on another thread to try something similar but that main form was bound and the need was to link subforms to each other. I have never actually used Master/Child subform linking on unbound main form so the technique slips my mind.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 6
    Last Post: 11-17-2011, 10:50 PM
  2. Form Filtering
    By Kapelluschsa in forum Forms
    Replies: 5
    Last Post: 06-06-2011, 12:05 PM
  3. Query (Filtering?) in a Form
    By bobhra in forum Forms
    Replies: 2
    Last Post: 01-09-2011, 02:45 PM
  4. Filtering a Continuous Form
    By sbrookebounds in forum Forms
    Replies: 5
    Last Post: 12-14-2010, 11:41 AM
  5. remove filtering of a form
    By maxbre in forum Forms
    Replies: 3
    Last Post: 10-30-2010, 10:22 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