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

Equivalent to VB sleep command

Status
Not open for further replies.

M8tt

Technical User
Feb 11, 2003
43
NL
VB has a command that allows the program to sleep for a specified period of time.

Is there an equivalent piece of Crystal syntax that will allow me to delay the generation of data within the Report?
e.g. - Detailed Section A would process
- Detailed Section B would contain a Formula to
pause the Report generation for say 1 second
- Detailed Section A would process
- etc, etc

 
VB has a sleep command? I've never seen that. What is it?

I thought to make VB sleep like Oracle or Unix, you had to force it to go through a loop or API call to mimic sleep.

This is what you'd have to do with Crystal (a loop - or subreport call, as opposed to an API call), as there is no sleep function.

Naith
 
Naith,

The command is simply "Sleep" followed by the amount of time to sleep for. As in the example below which effectively paused the code between the sending of 2 Keystrokes.

SendKeys "(f)", True
Sleep 1000
SendKeys "(e)", True

I've already tried a subreport which didn't give me what I wanted. Is there any other way to loop?
 
Fascinating. I really didn't know VB had that functionality. Learn something new every day, I suppose.

I just want to be sure that we're on the same page here: are you trying to force Crystal to sleep because you're assuming it will return the sections prior to the sleep, before then returning the other sections?

The only way this can happen is if the section before the sleep is revealed in a subreport, with everything after the sleep in the main report or another subreport.

If you do something to force Crystal to waste time without incorporating an initial subreport, you won't see any data returned at all before the sleep - unless you force the time-wasting to ensue after the first page of the report. All you'll get is a blank screen with "Reading Records..." in the corner.

The initial loop suggestion would be aimed at creating a loop which was set to loop, say, 1000 times. For loops/Do While loops are as they are for Basic - check out F1 in Crystal.

You could also call a subreport, which depending on what the subreport was doing, would certainly take a second or more to execute. (You'd have to ensure that if it was placed in a recurring section, that the section would be set to suppress on each subsequent run after the initial time.)

I've never heard of anyone wanting to make their report slower before, but there's certainly a few ways to harm the performance. I'm just not sure that the way the performance will be hindered, and what you expect are the same.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top