Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Old Saybrook, Connecticut, USA
    Thanked 0 Times in 0 Posts

    Using Filter by Form on multiple forms (2003)

    I have a very simple database (one table). I have one form (called "Documents") for doing searches using Filter by Form.
    When I get the results, I want to apply the filter to another form (called "Printable") in order to print them.
    I am new to Access & moderately familiar with VB. I cannot figure out a way of saving the first FilterbyForm to a variable or query and then applying it to the "Printable" form. Presumably this is pretty simple, I just haven't been able to figure it out.
    Any help would be appreciated.

    John Heckman

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Using Filter by Form on multiple forms (2003)

    A form has two properties that are relavant here:
    Filter is a string that holds the current filter ("" if none)
    FilterOn is a Boolean (Yes/No value) that specifies whether the filter is currently active.

    You could do something like this:

    Private Sub cmdOpenPrintable_Click()
    Dim strFilter As String
    If Me.FilterOn = True Then
    strFilter = Me.Filter
    End If
    DoCmd.OpenForm FormName:="Printable", WhereCondition:=strFilter
    End Sub

    Note: I never use a form for printing, I always use a report for that purpose. A report can also be opened with a WhereCondition argument.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Schenectady, New York, USA
    Thanked 0 Times in 0 Posts

    Re: Using Filter by Form on multiple forms (2003)


    On the event of a Print Report Button from your form use

    DoCmd.OpenReport "Report_Name", acViewPreview, Me.Filter
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts