By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

i want to preview what i'm printing out

P: 1
I want to print my access report from and I have the code below:

Expand|Select|Wrap|Line Numbers
  1. Sub PrintRelatorio()
  2. Dim oAccess As Microsoft.Office.Interop.Access.Application
  3. ' Start a new instance of Access for Automation:
  4. oAccess = New Microsoft.Office.Interop.Access.Application()
  5. ' Open a database in exclusive mode:
  6. oAccess.OpenCurrentDatabase(filepath:="C:\PM_GEA\GEA\tmp\FICH_Access\Link_GEA.accdb", Exclusive:=True)
  7. 'Preview a report named Sales:
  8. oAccess.DoCmd.OpenReport(ReportName:="rpt_Processo", _
  9.            View:=Microsoft.Office.Interop.Access.AcView.acViewPreview)
  10. ' Print a report named Sales:
  11. oAccess.DoCmd.OpenReport(ReportName:="rpt_Processo", _
  12.            View:=Microsoft.Office.Interop.Access.AcView.acViewNormal)
  13. End Sub
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
Mar 17 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.