Problem Statement: Access 97 glitches on 12 lines of code in a report that is being emailed in snapshot format using the SendObject method.
A report containing 64 image controls where the “picture” properties are set by code in the On Format event cannot be sent in Snapshot Format using the SendObject method in an Access 97 database.
…The report can be printed or viewed without error.
…If a specific 12 (of the 64) lines of code (that are used to set the picture property for the image controls) are dimmed, then the report can be sent without error. Only these specific 12 lines cause the error, however, they are virtually identical to all of the rest – just referencing a different control.
…If the database is converted to Access 2000 the entire report (all image controls) can be sent without error. Note: I need to use Access 97 because it will eventually be converted to a runtime application using the Access 97 ODE and a third party installation program for Access 97.
Created new database and imported all objects except the form that contains the command button that is used to “Send” the report and the report itself. Then rebuilt both the form and report in the new database. The new database produced exactly the same results.
Error message: (upon clicking the “Send” command button)
Error No: 2465
Microsoft Access can’t find the field ‘Forms’ referred to in your expression.
You may have misspelled the field name, or the field may have been renamed or deleted.
**** Code from the form’s On Click event for the “Send” command button *************************
strOutputFormat = "Snapshot Format" ‘Note: This format is undocumented except by an example.
DoCmd.SendObject acSendReport, stDocName, strOutputFormat, strEmail, , , strSubject, strMsg, True
**** Code from the report’s On Format event for the Page Header *******************************
Dim frm As Form
If Not IsLoaded("frmPlay") = True Then
Set frm = Forms!frmPlay
Me.imgA1.Properties("Picture") = frm!cmdA1.Picture
Me.imgA2.Properties("Picture") = frm!cmdA2.Picture
Me.imgB1.Properties("Picture") = frm!cmdB1.Picture
Me.imgB2.Properties("Picture") = frm!cmdB2.Picture
Me.imgC1.Properties("Picture") = frm!cmdC1.Picture
Me.imgC2.Properties("Picture") = frm!cmdC2.Picture
*** Note: Prior to using the “frm” object variable the code just referenced the specific form with the same results (i.e. Me.imgC2.Properties("Picture") = Forms!frmPlay!cmdC2.Picture).