Aurimas
Aurimas

Reputation: 2493

Alter MS Access Report output after its loaded

I am using MS Access 2007. I have a table, where, among other things, I have a hyperlink field. There, I save hyperlinks to images associated with the records. Now, I'd like to have a MS access report where I could output these records, but instead of displaying clickable hyperlink fields, I'd like to show the images themselves.

I know I can add an unbound images to MS Access report, but I cannot figure out how to proceed. I imagine I could have images with "random" source, and on report generation just replace the source with the values from my hyperlink fields. But so far I have found no examples / documentation to anything similar - what events should I use, how can I iterate through the records that are being printed out?

Edit:

Thanks to @HK1, I found the Detail_Format event. However, it is only triggered when PrintPreview view is loaded, not the Report view. That would not be a problem in itself, as I can simply switch back-and-forth between views, but a strange thing happens:

In Print preview, the three records would be updated each based on their respective values. When switching back to ReportView, they suddenly all obtain the value of the last record.

For example, say I have a textbox "foo" and three records with IDs 1,2,3. The code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  Me!foo.Caption = Me!ID.value
End Sub

It updates the three textboxes to contain 1, 2 and 3 respectively in the PrintPreview view. After switching back, I get all three textboxes with 3. Any ideas how I could fix that?

Upvotes: 1

Views: 560

Answers (1)

Tim Lentine
Tim Lentine

Reputation: 7862

Have a look at this article: Use images in your Access forms, reports and controls. In it they discuss the pros and cons of a variety of approaches when dealing with images in Access.

Upvotes: 0

Related Questions