I execute the same code on two different machines. On one machine it works without error. (Both machines are running Windows 95 and Access 97). On the second machine I get the following message:
The Detail Window associated with this error states, "MSACCESS caused an invalid page default".
The corresponding code is below.
After I step through the code using the debug, the code cycles through, produces a separate report for each POC and does not crash.
Private Sub Report_Page()
'Identify a variable to hold the report file name
Dim strReportName As String
Dim strDir As String
Dim strPOCName As String
Dim strDateMonth As String
Dim strDateDay As String
Dim strDateYear As String
Dim strDate As String
'Get the path for which to store the report
'Remember that the default directory must be set in Access via Options Menu
strDir = CurDir & "\POC_Proj_Num\"
'Create date for file name
strDateMonth = Format(Date, "mmm"
strDateDay = Format(Date, "d"
strDateYear = Format(Date, "yyyy"
strDate = strDateMonth & strDateDay & strDateYear
'Get POC name
strPOCName = Me!txt_POC
'Establish the report file name
strReportName = strDir & strPOCName & strDate & "." & "rtf"
'Save the report to a file
DoCmd.OutputTo acReport, "POC_Project_Num", "RichTextFormat(*.rtf)", strReportName
'Close the report to contine processing the remaining POC's reports
DoCmd.Close acReport, "POC_Project_Num"
End Sub
The first time the code is executed the code crashes on the
DoCmd.Close acReport, "POC_Project_Num" line.
The Detail Window associated with this error states, "MSACCESS caused an invalid page default".
The corresponding code is below.
After I step through the code using the debug, the code cycles through, produces a separate report for each POC and does not crash.
Private Sub Report_Page()
'Identify a variable to hold the report file name
Dim strReportName As String
Dim strDir As String
Dim strPOCName As String
Dim strDateMonth As String
Dim strDateDay As String
Dim strDateYear As String
Dim strDate As String
'Get the path for which to store the report
'Remember that the default directory must be set in Access via Options Menu
strDir = CurDir & "\POC_Proj_Num\"
'Create date for file name
strDateMonth = Format(Date, "mmm"
strDateDay = Format(Date, "d"
strDateYear = Format(Date, "yyyy"
strDate = strDateMonth & strDateDay & strDateYear
'Get POC name
strPOCName = Me!txt_POC
'Establish the report file name
strReportName = strDir & strPOCName & strDate & "." & "rtf"
'Save the report to a file
DoCmd.OutputTo acReport, "POC_Project_Num", "RichTextFormat(*.rtf)", strReportName
'Close the report to contine processing the remaining POC's reports
DoCmd.Close acReport, "POC_Project_Num"
End Sub
The first time the code is executed the code crashes on the
DoCmd.Close acReport, "POC_Project_Num" line.