Subreport not being shown in report (1 Viewer)

Mario

Registered User.
Local time
Today, 13:53
Joined
Jul 3, 2002
Messages
67
Hello,

Here is the problem: I am converting my application (that used to work fine) from Access 97 to 2002. I have in my report some subreports that are graphs from Excel.

The problem is when my report appear in preview format, the graphs aren't shown BUT if I switch to design view and then back to preview I can see them!! What's going on?

I did put in my VB code what I just explained (switching from preview to design and then back to preview) but it doesn't work. I have to do it manually, which is unacceptable. Somebody knows how to fix this?
 

llkhoutx

Registered User.
Local time
Today, 12:53
Joined
Feb 26, 2001
Messages
4,018
Your subform probably isn't linked properly to your main form. Check the Parent and Child Links of the subform.

Also, always requery your subform on the AfterUpdate event of the form Parent Link field.
 

Mario

Registered User.
Local time
Today, 13:53
Joined
Jul 3, 2002
Messages
67
llkhoutx,

thanks for the help but I'm not dealing with a main form and a subform. It is a report and subreports. There is no AfterUpdate event for subreports. Also, I tried the requery method but it does not work for reports. Finally, I haven't tried the Parent and Child Links since I doubt my problem is related to this.

Any other suggestions?
 

Mario

Registered User.
Local time
Today, 13:53
Joined
Jul 3, 2002
Messages
67
Well I finally found out how to solve this particular problem... Very stupid indeed but it works: I simply close my report and reopen it with VB... Thanks for your help.
 

llkhoutx

Registered User.
Local time
Today, 12:53
Joined
Feb 26, 2001
Messages
4,018
Sorry, my mistake. Forms and reports are analogous in many respects.

You say that your subreports are " . . . graphs from Excel." What does that mean.

Did you build the graphs in Excel, cut then and then paste then into an Access report? Or, do you generate the graphs in Access with the chart button on the toolbox menu bar (it's not there by default, but can be added, if used)?

When a graph doesn't appear, I think that that means that there is no data. Your graph will always show in design view, it's not data dependent.

Check the rowsource for your graphs. It sounds like they're incorrect.

Try opening the report in design view hidden, and then open it in normal or preview mode. The time to do this may or maynot be noticible.

Also, you can requery a report or subreport after opening the report in normal or preview mode.
 

llkhoutx

Registered User.
Local time
Today, 12:53
Joined
Feb 26, 2001
Messages
4,018
Sorry, my mistake. Forms and reports are analogous in many respects.

You say that your subreports are " . . . graphs from Excel." What does that mean.

Did you build the graphs in Excel, cut then and then paste then into an Access report? Or, do you generate the graphs in Access with the chart button on the toolbox menu bar (it's not there by default, but can be added, if used)?

When a graph doesn't appear, I think that that means that there is no data. Your graph will always show in design view, it's not data dependent.

Check the rowsource for your graphs. It sounds like they're incorrect.

Try opening the report in design view hidden, and then open it in normal or preview mode. The time to do this may or maynot be noticible.

Also, you can requery a report or subreport after opening the report in normal or preview mode.
 

Mario

Registered User.
Local time
Today, 13:53
Joined
Jul 3, 2002
Messages
67
Well, thanks for your advice.

When I said "graphs from excel" I mean that I have a subreport that contains an OLEObject representing an Excel chart. So basically, the graphs are generated FROM access but WITH Excel... The chart option in Access is not enough evolved for my needs.

There is indeed data for my charts and the rowsource are also correct.

I solved the problem by putting in my code 2 lines: one that close my report (and saved it) and the second reopen it (in preview mode):

DoCmd.Close acReport, "ReportCopy", acSaveYes
DoCmd.OpenReport "ReportCopy", acViewPreview

I tried before to switch back from preview mode to design and then back to preview. If this is done manually, the graphs appeared BUT if I code this (which shouldn't make a difference) the graphs are still invisible in preview mode... Weird Weird Weird...

However, the problem has been solved. I thank you very much for your help.
 

Users who are viewing this thread

Top Bottom