i want to preview what i'm printing out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • william3n
    New Member
    • Mar 2015
    • 1

    #1

    i want to preview what i'm printing out

    I want to print my access report from vb.net and I have the vb.net code below:

    Code:
    [B]Sub PrintRelatorio()[/B]
    Dim oAccess As Microsoft.Office.Interop.Access.Application
    ' Start a new instance of Access for Automation:
    oAccess = New Microsoft.Office.Interop.Access.Application()
    ' Open a database in exclusive mode:
    oAccess.OpenCurrentDatabase(filepath:="C:\PM_GEA\GEA\tmp\FICH_Access\Link_GEA.accdb", Exclusive:=True)
    'Preview a report named Sales:
    oAccess.DoCmd.OpenReport(ReportName:="rpt_Processo", _
               View:=Microsoft.Office.Interop.Access.AcView.acViewPreview)
    ' Print a report named Sales:
    oAccess.DoCmd.OpenReport(ReportName:="rpt_Processo", _
               View:=Microsoft.Office.Interop.Access.AcView.acViewNormal)
    [B]End Sub[/B]
    question #1 I want to use the sql query SELECT to chose what to print ou from my database in access,
    Question #2 I want to preview what I'm about to print before it goes to the printer.

    OBS: the code is working perfectly but it's printing all the data in my database instead of just one, and I can't preview the report
    Last edited by Rabbit; Mar 18 '15, 02:02 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...