Running VBA in a Microsoft Access Report before Printing
I've created a report which is used to display a customer's address along with a logo.
The logo filepath is stored in the customer record and is loaded into a picture using some vba in the On Load event.
Me!Image01.开发者_运维百科Picture = logoPath
This works fine when previewing but when using DoCmd.openReport and sending it straight to print the code is not run.
My question is how do I get the code, which works fine if executed, to run before the report is sent to the printer?
If you put your code in the Detail_Format
event, it should work.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me!Image01.Picture = logoPath
End Sub
精彩评论