Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    136
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print a Filtered Datasheet (Access 2003)

    Hello Access Gurus,

    I am wanting to print a list of the filtered records from a form. I have a form that displays a table in datasheet view and when a user chooses Filter By Selection, I would like them to be able to print just the filtered records. Is this possible? I have tried the DoCmd.PrintOut acSelection but it does not work for datasheet view.

    Regards,

    Jocelyn

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Print a Filtered Datasheet (Access 2003)

    Simply use DoCmd.PrintOut. This will print all currently filtered records. DoCmd.PrintOut acSelection will print only the currently selected records.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    136
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print a Filtered Datasheet (Access 2003)

    Thanks Hans,

    That works thanks. However, the table is rather large and would be better to send to a report where I can adjust the object sizes to fit. Can you tell me how to send the filtered selection to a report?

    Regards

    Jocelyn

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Print a Filtered Datasheet (Access 2003)

    You can use code like this:

    Sub FilteredReport()
    Dim strFilter As String
    If Me.Dirty Then
    RunCommand acCmdSaveRecord
    End If
    If Me.FilterOn Then
    strFilter = Me.Filter
    End If
    DoCmd.OpenReport "rptEmployees", acViewPreview, , strFilter
    End Sub

    This assumes that the code is in the form's module.

  5. #5
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    136
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print a Filtered Datasheet (Access 2003)

    Thanks Hans,

    That is exactly what I wanted. Much appreciated.

    Regards

    Jocelyn

Posting Permissions

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