Strange: No Sub-Report Data Unless Switch Preview, Design, Preview

W

wrldruler

Hello,

Here is a strange problem that I am having on a couple reports which
are designed the same.

I donwloaded a calendar report off a popular Access site (can't
remember which one). And I customized it. It's got one sub-report,
that is copied 30+ times on the report. I then iterate through
controls to set the appropriate dates, draw the lines, etc.

When I first Preview the report, January has the correct dates and
lines. But there is no data in the subreport.

I hit the Record > button, and February loads perfectly. I hit Record
back < and January still has no data.

Here is the strange part: I change to Design View, then switch right
back to Preview. Suddenly January has data.

So, January (or whatever first month I tell to load first) does not
load data to the sub-report unless I switch from preview, to Design,
and back to Preview.

On my forms, I've been forced to call the report using the following:

DoCmd.OpenReport "rpt_ReleaseCalendar", acPreview
DoCmd.OpenReport "rpt_ReleaseCalendar", acViewDesign
DoCmd.OpenReport "rpt_ReleaseCalendar", acPreview

Anybody know why this is happening?

Thanks,

Chris
 
G

Guest

It's difficult to guess without any knowledge of how your report is set up
and/or code used. I assume the Link Master/Child properties are used.
 
W

wrldruler

FYI.

After 4 hours of playing around, I finally figured out my problems,
and learned a little about creating complex, programtically driven
reports in Access.

Here is a FYI summary of what I did to fix, in case any reads this
later.

I had two major problems:

*****************
(1) My first page would always load blank

This was caused by my Format Event firing twice on entry (which I read
later is a normal problem). This was screwing me up, so I made the
Event fire only once with this:

Dim Stop_From_Loading_Twice as Integer

If Stop_From_Loading_Twice = 99 Then
Exit Sub
Else
SetDays
Stop_From_Loading_Twice = 99
End If

*****************
(2) I then found out (from my customers) that the report was looking
perfect on Preview, but was missing data on Print -- without rhyme or
reason why some data was missing, and others were present on Print.

This was because I was calling my Build_Calendar function on Group
Footer Format, but not on Group Footer Print. So I simply added a call
to this function on Print.

*****************
(3) Some other things I did which may or may not have helped:


Placed "Option Explicit" at top of page, and found some implicit
variables

Defined all variables as page variables at top of page -- ensured I
wasn't using the same variable for more than one purpose

Created a function that simply sets all variables to 0 or ""

Called the Clear_Variables function before & after my main
Build_Calendar function loaded -- ensured junk data wasn't lingering
between function calls.

Thanks,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top