Show a repoet with a hiden AccessWindoe

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to Show a repoet with a hiden AccessWindoe
i am useing a code to hide the AccessWindow but in one of the forms i have a Print Preview Cmd and it shows the Report in the hiden Accesswindow
 
"Show a repoet with a hiden AccessWindo" <Show a repoet with a hiden
(e-mail address removed)> wrote in message
Does anyone know how to Show a repoet with a hiden AccessWindoe
i am useing a code to hide the AccessWindow but in one of the forms i
have a Print Preview Cmd and it shows the Report in the hiden
Accesswindow

I'm not sure, but try putting this code into a standard module:

'----- start of module code -----
Option Compare Database
Option Explicit

Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As Long) _
As Long

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Public Sub OpenAReport( _
ReportName As String, _
Optional View As Integer = acViewNormal, _
Optional FilterName As Variant, _
Optional WhereCondition As Variant)

DoCmd.OpenReport ReportName, View, FilterName, WhereCondition

If View = acViewPreview Then
Call SetParent(Reports(ReportName).hwnd, GetDesktopWindow)
' DoCmd.Maximize ' This is optional
' DoCmd.RunCommand acCmdFitToWindow ' Also optional
End If

End Sub
'----- end of module code -----

Then, in your other code, instead of opening the report using
"DoCmd.OpenReport acViewPreview, ...", call the OpenAReport subroutine
with suitable arguments.
 
Back
Top