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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DELAY IN LOADING DATA INTO REPORT??

Status
Not open for further replies.

dabineri

Programmer
Jun 20, 2001
265
US
I am using VB6, CR9 RDC. I am using DAO.

At one point, I am loading a table with data in preparation for printing and then I call the CRViewer to print it.

It sometimes comes up empty or incomplete and yet when I click the refresh button all the data shows. I have tried putting in a time delay in case it is trying to print too soon after loading the data into the table and that seems to work a little better.

I cannot find a command that will guarantee that the table is finished loading before the printing starts (in case this is the problem) although it seems that it should be.

Can anyone suggest what might be happening here and also any possible solutions?

Thanks for any advice. David Abineri

 
If you know about how long it seems to take the temp table to get filled, you can just go ahead and make the application "sleep" for that period of time, before calling the report. A fine example using the Sleep API can be found here: thread222-901069.

-dave
 
Is it possible that this could in fact be happening. If I load the table and then print, could it actually be that it could start printing before the table is loaded?

Thanks for the response, David Abineri

 
I can only guess, since I don't know what else is going on in your application. I remember you having this problem a while back, and I'd even dusted out my old VB books since I hadn't used DAO for years (thread149-887240). I guess it's possible that the data isn't yet in the table by the time you've loaded the report. Maybe putting the app to sleep for a while is indeed your solution.

-dave
 
Thanks for remembering, Dave.

Is there a difference between putting it to sleep or simply using a timer loop that includes a DoEvents?

Thanks again, David Abineri

 
I think either one would do the job, so go with whichever you feel most comfortable using.

-dave
 
Dave, I was experimenting further with this issue and found that it seemed to disappear when I did the

reportt.SelectPrinter DriverName, DeviceName, PrinterPort

AFTER the

CRViewer9.ViewReport command.

I also found that the paper orientation seems only to work if it is placed AFTER the SelectPrinter command.

What is the correct ORDER in which to properly set up and call the viewer?

Thanks for your help, David Abineri

 
David,

Have a look at my final post in this thread: thread766-789962. I'm pretty sure that I've got the necessary order laid out there.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top