• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

Need help with OLE Object auto resize in a report

So I've been trying to get the Lebans autoresizeole to work with a report. I've tried to execute the code from the report open, activate, change events with no success. It doesn't work when i open the report or do a print preview. I've even tried to execute the code from the report area format event. I've only been able to get it to work when I open the report and execute it using the double click event.
I can't help but suspect that the code is executed before the object is populated from the data table. That would make sense anyways.
Does anyone have any idea about how I can get this to function the same as with the form? It works perfectly with the form!
0
jcgroove
Asked:
jcgroove
  • 5
  • 4
1 Solution
 
IrogSintaCommented:
I'm not sure I can help but I'm wondering if your OLE object have a Source Doc?  If so, maybe you can add it by code prior to running Leban's code.

Me.NameOfControl.SourceDoc = "path and file of document"
...Lebans code
0
 
jcgrooveAuthor Commented:
Thanks for the response. The bitmap that populates the ole object frame that the code effects is stored in the main table with the text data. It isn't from a separate source document.
0
 
IrogSintaCommented:
Okay, how about adding the ControlSource via code prior to running Leban's code.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
jcgrooveAuthor Commented:
I could not figure out the right way to do what you're recommending. The table the report is built from is "Main Question Bank" and the ole table field is "DRAWINGS".
The OLE frame on the report is named "OLEAutoResize"
0
 
IrogSintaCommented:
In the report's Open event, can you try adding
Me.OLEAutoResize.ControlSource= "DRAWINGS"

before running Leban's routine?
0
 
jcgrooveAuthor Commented:
Ok I tried what you recommended but it still doesn't work. I was able to get it to work with some bugs by putting it in the detail format section of the report but it only works on print preview not when opening the report.
The problem i have now is that when there is no object in the OLE frame it alerts an error telling me the frame is empty. On the entries with no OLE objects the empty frame fills up the empty space left on that page of the report whereas on entries that do have objects in the OLE frame, the frame correctly resizes to the size of the image.
0
 
IrogSintaCommented:
Were you trying to get it to work in the Report View?  I don't believe Leban's code can work in that view since Report View only came to being since version 2007.  It definitely would work in Print Preview though.  

You could do a check to skip his code if the frame is empty.
If Not IsNull(Me.OLEAutoResize) then
     Leban's code
End If

Open in new window

0
 
jcgrooveAuthor Commented:
Sorry for the delay. Here's what I've tried:
I tried to add the if statement to check if the frame was empty. I also added a msgbox to help me see what was going on. With that, it appears the code runs when it formats and when it pops up the print preview. If only records where the object frame is empty are selected, everything works swimmingly. However, if a record with an image in the frame is selected in addition, it appears that the code resizes all the OLE object frames on the report regardless of whether or not there is an image in the OLE frame. So even the empty frames are the same size as the frame with the image in it.
So then I tried to give the empty frames a given size in the "else" portion of the checking for empty if/then statement. This seems to work pretty well with a particularly substantial drawback. The generated report gives each record its own page regardless of the size of the empty frame (50x50). I know it doesn't sound too bad, but that is the primary reason I'm trying to get this functionality to work. To get multiple records (if the OLE frame is empty) on one page and if the frame isn't empty, to resize the frame and continue on.
Any ideas?
0
 
IrogSintaCommented:
Check to make sure that the CanShrink property of the detail section where your frame is set to true.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now