Close a report in preview mode with VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

anonymous_at_discussions.microsoft.com
Date: 09/29/04


Date: Wed, 29 Sep 2004 02:02:38 -0700

Figured it out:

If Forms!bhr!StatusId = 5 Then
   stDocname = "rBrevVentelisteEnkel"
        With DoCmd
        .OpenReport stDocname, acPreview
        .RunCommand acCmdPrint
        .Close acReport, "rBrevVentelisteEnkel"
        End With

       End If

>-----Original Message-----
>Hi ..
>
>I have a code allowing users to choose printer for
>printing a report. To do this, the report must be opened
>in preview mode..But how do I close the report, it locks
a
>table when it's open, preventing other users to open a
>report.
>
>Dim stDocname As String
>
>If Forms!bhr!StatusId = 5 Then
> stDocname = "rBrevVentelisteEnkel"
> With DoCmd
> .OpenReport stDocname, acPreview
> .RunCommand acCmdPrint
> End With
>End If
>
>Snurre
>.
>



Relevant Pages

  • Re: Email Code
    ... > Dim stDocName As String ... there is no way to filter the records in the report *from within the ... Private Sub Report_Open ...
    (microsoft.public.access.formscoding)
  • Re: Losing data from memo field when exporting to Excel
    ... enter the date once for every report. ... Dim stDocName As String ...
    (microsoft.public.access.externaldata)
  • Re: Printouts NOT coming out in order they are sent???
    ... You using two COMPLETE different approaches to printing the repots. ... tell access to print the report, BUT DO NOT display it.. ... The display and graphics and rendering systems of windows is a highly ...
    (comp.databases.ms-access)
  • RE: Printing from ASP.NET application
    ... when performing printing on ASP.NET web page,correct? ... server-side .NET code that deal with printer will only affect the server ... Microsoft MSDN Online Support Lead ... I don't want the end user to have to view the report and then select the ...
    (microsoft.public.vsnet.general)
  • Re: Printouts NOT coming out in order they are sent???
    ... You using two COMPLETE different approaches to printing the repots. ... tell access to print the report, BUT DO NOT display it.. ... The display and graphics and rendering systems of windows is a highly ...
    (comp.databases.ms-access)