Unanswered: How can I stop an activex ctrl (image) from being cut off at end of a report page?
Or perhaps the question should be 'how do I force my activex image control to go to a new page if it will not fit?'
I am using Access 7, and have designed an recipe-printing application with it. The user enters their recipes in a form then print them out as reports. An 'on open' event procedure looks up the 'design template' they've selected, and adjusts the font, color, size, header and footer image, etc accordingly. So a lot of what I've done has been put together in VBA.
Each record in the report contains a textbox (fed by a memo field in a table) followed by an activex control called DBPix. (I'm using DB Pix because it's more reliable in a runtime environment than the standard image control.) The image appears in different places on the page depending on how much text is entered before it.
The problem - if there is some space, but not sufficient space on the report for the image, it will display a few lines of pixels of the top of the image, then put the rest on a new page. I have attached a screenprint to show how it looks. (The user can choose various layouts - this is the 'half page' layout that prints the report 2-up in landscape for the user to cut up into a 5.5 x 8.5" booklet.)
Right now, the only solution I have is to tell our users to go to the individual record where it occurs and add in a few blank lines followed by a period in the text box, thereby increasing the size of the text box and forcing the image onto the next page. It's a clumsy solution, and if the user has opted for the records (their recipes) to print continuously rather than one-per-page, then fixing one problem image often causes the same problem to come up later in the report.
Any solutions? It would be great if we could get the image to always move to a new page when there's no room for it - alternatively, perhaps there's a way to always get an image to shrink to fit on the page?
To handle images, what I've done in the past (rather than deal with a 3rd party app and all the headaches that come with it, as you now see) is to store the location of the image on the local disk/network, and then change the control source of a generic picture on format. It dramatically cuts down on file size, as you don't have to embed every picture into your dB, and Access can handle it's own controls well enough.
Ah. So you reckon I wouldn't be having this problem if I was using Access's own image control?
I used the method you described initially. The user, in the runtime environment, would select their image through a form, and it would link to it on their local disk on opening the report.
The trouble is, a large percentage of our users had problems with this. They would go to add the image in, then get the error: 'The expression on click you entered as the event property setting produced the following error. The operation on the I object failed. The expression may not result in the name of a macro the name of a user-defined function or [Event Procedure]. There may have been an error evaluating the function event or macro.'
I ever able to find a common denominator with all the users who got this error.
Admittedly, this was way back when I was using Access 2002 and Access 2002 Runtime. Perhaps the problem no longer occurs - but I'll have to round up a big group of beta testers to find out, since I never got this error personally!