Results 1 to 2 of 2
  1. #1
    jacjacjac is offline Novice
    Windows XP Access 2000
    Join Date
    Dec 2012
    Posts
    7

    VBA how to print a subForm/datasheet or export to a report to print?

    Hello,

    My problem is I have a mainForm with a combo box that acts as a filter for a subForm/datasheet, the results are from a database, so depending on what what was selected, it will dynamically update the subForm/datasheet.

    The issue I want is whatever the user selects (and results displayed) I wish to be able to 'print' out the results.

    The SubForm/datasheet has four columns, ID, FirstName, LastName, DateOfBirth.

    Now im unsure of the best way, i thought I might be able to create a button (on the mainForm) that just prints what is displayed in the subForm/datasheet or do i export it to a report, what is the easiest way to print out the results?

    With whatever method, what is the process and code? I have googled it for both methds, printing out the datasheet (doesn't seem like i can) or printing a report, i can't seem to manage it with the dynamic contents of the subForm/datasheet.

    Thanks in advance,
    Jac

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    Forms are intended for data entry/edit and screen display. Reports are intended for data manipulation and output to print. Either can be used for the other purpose but not optimally.

    Create a report with the same RecordSource as the subreport and use button to open report. Apply the same filter criteria to the report, something like:

    DoCmd.OpenReport "ReportName", , , "fieldname='" & Me.comboboxname & "'"
    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. Print Report and Export it in PDF.
    By imtiaz703 in forum Reports
    Replies: 3
    Last Post: 09-03-2012, 07:22 AM
  2. Replies: 8
    Last Post: 11-08-2011, 05:11 AM
  3. Replies: 5
    Last Post: 10-26-2011, 02:59 PM
  4. Replies: 0
    Last Post: 02-22-2011, 05:04 AM
  5. Print,save as and export option in report?
    By sunny in forum Reports
    Replies: 1
    Last Post: 07-27-2010, 09:55 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