X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Detail_format Of Subreport Triggers On Each Page., Access 2003    
post Jul 7 2018, 11:13 AM

Posts: 77
Joined: 18-January 16

HI doods.

I was hoping to be spared of it, but need to adapt a report from Access 2016 to Access 2003. There was a subreport which included images (.png) for each record near the end of the primary report (about 6 records so it pulls 6 different pictures). On .accdb this can easily be setup in the "Control Source" property in the properties tab of the Picture control (don't know its VBA name since Picture doesn't has controlSource).

There is no such property on the Properties tab in access 2003 so I recurred to assign the picture property of the control in the OnFormat event of the Detail Section of the subreport. Although it shows the pictures as intended, it seems that the event triggers for each page that is displayed, so if the report has, say, 16 pages the event fires 16 times and, in addition to being lenghty, sometimes it actually interrupts the code. I tried to assign the picture property in the detail event of the main report but it kept the same picture for all records in the subreport, implying it assigned the filepath of the first record on all of them.

Is there a place where I can assign the Picture property without firing the event more than 1 time?
Go to the top of the page
post Jul 8 2018, 01:41 AM

Posts: 199
Joined: 2-April 18

QUOTE (javert)
There was a subreport which included images (.png) for each record
If you can modify it, use bmp, perhaps this solve your code interruption problem.
It seems your VBA code is properly written. So I would suggest to convert png to bmp and to use those images. Are those pictures very "heavy" in file size? are they saved in your db as OLE object or do you use their path? In the latter situation, where are they? local or netword resource?

Please forgive in advance my horrible English.
Go to the top of the page
post Aug 9 2018, 12:47 PM

Posts: 77
Joined: 18-January 16

Just to finish this, I solved this by moving the code from the Format Event to the Print Event so it reads like:

Private Sub MyReport_Print(Cancel as Integer, PrintCount as integer)

If Len(Dir( Here goes the record depending location )) > 0 then
Me!ImageControl.Picture = Location
End If

End Sub
This post has been edited by javert: Aug 9 2018, 12:48 PM
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    16th August 2018 - 09:41 AM