Public Sub CreateNewReport()
Dim rpt As Report
Dim strRptName As String
Set rpt = CreateReport()
With rpt
.Caption = "My Caption"
strRptName = .Name
With .Printer 'Для А2002 и выше
.Orientation = acPRORLandscape '= acPRORPortrait '
.TopMargin = 567
.LeftMargin = 567
.RightMargin = 2 * 567
.BottomMargin = 567
End With
End With
Set rpt = Nothing
DoCmd.Close acReport, strRptName, acSaveYes
'Здесь бы надо проверить, нет ли уже отчета с именем "NewReportName"
DoCmd.Rename "NewReportName", acReport, strRptName
End Sub
|