How to Print Report on MS Access

Manufacturers started coming up with their own versions of male sexual performance products but natural supplements were something that soon replaced almost all other versions in the market. purchase female viagra An ever-increasing quantity cheapest cialis soft of men came forward claiming the substance causes Propecia negative effects like impotence problems, reduced libido, testicular pain, unusual climax and despair. It is also known as erectile samples of levitra dysfunction which particularly affects the men between the ages of 40 – 70. These are two cavernous canadian online viagra bodies run lengthwise and a soft body.


How to Print Report

In this How To, I will show you how to print a report. Users can print out all records or a specific record or range of records. The user can use either VB code or Macro to print as I will show the how to below. There are two most common methods to print.

  1. Print Preview Report: The user will see how the report looks like before printing. The Print Preview toolbar will display on the Navigation toolbar that allow to print and to do other options with this report such as exporting to MS Word, Excel, PDF etc.
  2. Print Report: Print report without seeing the report on the Print Preview. The report will be print immediately after clicking a Print Report button.

Preview All Records

Customer Form with Preview Report button. Add VB code or Macro under the click Event Procedure of Preview Report button.

customer all

VB Code:
Private Sub Command12_Click()
Dim stDocName As String
    stDocName = "rptCustomerInfo"
    DoCmd.OpenReport stDocName, acPreview
End Sub

Macro:

macro print preview

Preview Report: for All Records with Print Preview toolbar

customerList


Preview a Selected Record

If you want to print only a current record that displays on form, you can choose from the drop-down combo box or use the navigation bar on the bottom of form. Update the VB code or Macro below under the click Event Procedure of Preview Report button. For example below, the customerID 10 for Starbuckses is selected.

print from form

VB Code:
Private Sub Command12_Click()
Dim stDocName As String
Dim strWhere As String
If IsNull(Me.cboCustomer) Then
    MsgBox "Please select a customer", vbInformation, "Customer Needed"
Else
    stDocName = "rptCustomerInfo"
    strWhere = "[Customer_id] =" & Me.cboCustomer & ""
    DoCmd.OpenReport stDocName, acPreview, , strWhere
End If
End Sub
Macro:

macro print preview certain record

Preview Report: for a Selected Record

This is an example of Preview Report for “rptCustomerInfo” report. It will display the detail information of CustomerID 10 for a CustomerName Starbuckses.

selected customer on report


Print All Records

The VB code and Macro will be similar to Preview Report.

For VB: change acPreview  to acViewNormal

For Macro: change View from Print Preview to Print

Example VB Code:
Private Sub Command12_Click()
Dim stDocName As String
    stDocName = "rptCustomerInfo"
    DoCmd.OpenReport stDocName, acViewNormal
End Sub
Example Macro Code:

macro print all

Print a Selected Record

print from form

VB Code:
Private Sub Command12_Click()
Dim stDocName As String
Dim strWhere As String
If IsNull(Me.cboCustomer) Then
            MsgBox "Please select a customer", vbInformation, "Customer Needed"
Else
            stDocName = "rptCustomerInfo"
            strWhere = "[Customer_id] =" & Me.cboCustomer & ""
            DoCmd.OpenReport stDocName, acViewNormal, , strWhere
End If
End Sub
Macro Code:

macro print certain record





Print Many Records per page

Example below is a design view of report that we want to print out with a cover sheet for page header and the record detail on the Detail Section. There will be many records or customers printed out on one page per picture below.

design reportcover sheet many record

Print One Record per page

Some time we want to print a cover sheet for each customer or each record. The VB code or Macro will be the same as above; however the report itself needs to be adjusted. Refer to steps below:

  1. Create report
  2. Place text information or some fields on the Page Header section
  3. Insert other necessary fields on the Detail section
  4. Double click on the Detail bar section to open the Property Sheet
  5. Select “After Section” on the Force New Page under the format tab of property sheet of Detail Section.

design report one record per page

The report is displaying only on record per page to print out. However it will print all records of this report source. For the picture below, there are 14 records on this report. It will print in total of 14 pages of this report with same format of as a cover sheet for each record or customer.

cover sheet page 1 cover sheet



Related posts