Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Location
    Old Saybrook, Connecticut, USA
    Posts
    21
    Thanks
    0
    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
    heckman@heckmanco.com

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 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
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    John,

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

    DoCmd.OpenReport "Report_Name", acViewPreview, Me.Filter
    Don
    <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
  •