Center a report without access to design mode

constantG

Registered User.
Local time
Today, 23:34
Joined
Jun 24, 2009
Messages
92
Hi,

I use the following to enable users to create an address report and display it for printing.

Code:
Sub LabelWizard()
'On Error GoTo ErrorHandler

    Dim dbs As Database
    Dim Rpc As Container
    Dim rpt As Document
    
        Set dbs = CurrentDb
        Set Rpc = dbs.Containers!Reports

        Application.Run "acwzmain.mlbl_Entry", "qryAddress"

        For Each rpt In Rpc.Documents
            
            If InStr(rpt.Name, "Familygram") Or InStr(rpt.Name, "Personal") Or _
               InStr(rpt.Name, "rptHastenerReport") Then
                GoTo NextReport
            Else
                DoCmd.Close acReport, rpt.Name, acSaveYes
                [COLOR="Red"]DoCmd.OpenReport rpt.Name, acViewDesign
                Reports(rpt.Name).AutoCenter = True
                DoCmd.Close acReport, rpt.Name, acSaveYes[/COLOR]
                    
                Select Case MsgBox("Your labels are ready for printing." & vbCrLf & _
                            "Do you wish to preview them before printing?" & vbCrLf & vbCrLf & _
                            "Pressing No will continue and all addresses will be printed.", _
                            vbQuestion + vbYesNoCancel, _
                            "Address Labels..")
                Case vbYes
                If Me.cboSelectFile = "Single User Address" Then
                    DoCmd.OpenReport rpt.Name, acViewPreview, , "[intPersId]=" & [intPersId], acDialog
                Else
                    DoCmd.OpenReport rpt.Name, acViewPreview, , , acDialog

                End If
                Case vbNo
                If Me.cboSelectFile = "Single User Address" Then
                    DoCmd.OpenReport rpt.Name, acViewNormal, , "[intPersId]=" & [intPersId], acDialog
                Else
                    DoCmd.OpenReport rpt.Name, acViewNormal, , , acDialog
                End If
    
                    MsgBox "printed"
                Case vbCancel
                    GoTo NextReport
                End Select
            
            End If
NextReport:
        Next
                
        For Each rpt In Rpc.Documents
            
            If InStr(rpt.Name, "Familygram") Or InStr(rpt.Name, "Personal") Or _
               InStr(rpt.Name, "rptHastenerReport") Then
                GoTo NextReport1
            Else
                DoCmd.DeleteObject acReport, rpt.Name
            End If
NextReport1:
        Next
                
ExitPoint:
Exit Sub

If I don't include the code in RED, then the report opens in the top left of the screen and the top is not accessible (this is due to a macro which hides and restores the access window). So I added the code in red and it now opens in the middle of the screen ... Perfect.

The problem is that I want to make my program an MDE file and hence the code in red does not work as it is making design changes. Anyone know a work around?

Thanks in advance.

CW
 

Users who are viewing this thread

Back
Top Bottom