I want to print my access report from vb.net and I have the vb.net code below:
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
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 #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