Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with skipped reports when printing on a Network printer

Status
Not open for further replies.

Catrina

Programmer
Feb 11, 2000
70
US
I have creatred 2 reports using the DataEnvironment and DataReports. My problem is I call the printing of the reports one right after the other. When I am using the printer connected to my machine, they are fine, but when using a network printer, the first report does not print. When I step through the code, it prints, but not when run with no stops.

Should there be a delay between the reports? Why does the first one get skipped? Any ideas and suggestions for a fix would be great.

Here is a little detail on what I am doing.
I have one connection in the DataEnvironment(cnnReports),2 SQL Commands (ComHourly, ComSalary)
Both of these Select all from the needed query (Access 2000 DB). 2 reports, one with datamember comHourly and other with comSalary.

I format the data I need by opening the recordsets via code EX:

SQL$ = SQL$ & "VAL(RegHrs) * .01 AS RegHrs,"
SQL$ = SQL$ & "RecType,DeleteRec FROM HoursQuery WHERE "
SQL$ = SQL$ &amp; &quot;RecType='05' AND DeleteRec <>'D' &quot;
SQL$ = SQL$ &amp; &quot;ORDER BY Name ASC&quot;

DtaReports.rscomHourlyRpt.Open SQL$
RptHourly.Orientation = rptOrientLandscape
RptHourly.PrintReport

do the same thing for the second report.

THanks in advance for any help

Catrina
 
I am sure that Catrina has solved this problem since starting the thread, but for anyone else who is looking for a solution to this problem...

As stupid as it is, yes, you do need to pause between reports. I had a report that got displayed after I build a temp table of the data. If the data set was extremely small, I got no data on the report. I solved the problem by putting the call to the report on a timer (interval=1000) and enabling the timer where I normally would have displayed the report.

The error went away.

If anyone is inclined to give an explanation as to why this is I would love one.
Code:
If Not (DE.rsrsReport_Grouping.State = 0) Then
  DE.rsrsReport_Grouping.Close
End If
'If I break on the following line or above
'everything works fin
DE.rsReport_Grouping
'If I break on the following line or below
'I get an empty report
drptGenLedger.Orientation = rptOrientLandscape
drptGenLedger.Refresh
drptGenLedger.Visible = False
drptGenLedger.Show vbModal
drptGenLedger.Hide

I narrowed my code down to one line. So long as I paused in the proper areas (see comments), everything worked. So I threw all of this code in a timer and paused for one second before running it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top