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

Data Report shows no records unless I pause after command execution

Status
Not open for further replies.

Phil0206

Programmer
Oct 30, 2001
4
0
0
GB
I am using the data environment to set up commands to get records which are placed onto data reports. I have found that if the command is simply returning records (in this case one record) and not using groupings or aggregates then no record detail is placed on the report. If, however, I pause for say 5 secs after calling the command and use DoEvents then the record detail is on the report! Why? It's as though the command execution is asynchronoous (I haven't set this to be the case). How do I resolve this problem without using an arbitrary pause? Here is an example of my code:

'populate the report temp table with details first
If Not bPopVolTempReport(vdtmFrom, vdtmUntil) Then
bVolumeReport = False
Exit Function
End If

If deReport.rscmdVolumeRep.State = adStateOpen Then
deReport.rscmdVolumeRepByDate.Close
End If

'generate recordset to place in report
Call deReport.cmdVolumeRepByDate

'Need to pause report output
'without the next 6 lines or if PauseTime is less than 5
'no details appear on report
Dim PauseTime, Start, Finish, TotalTime
PauseTime = 5 ' Set duration in secs.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

'Ensure records have been got
If deReport.rscmdVolumeRepByDate.State <> adStateOpen Then
deReport.rscmdVolumeRepByDate.Open
Else
deReport.rscmdVolumeRepByDate.Requery
End If

While (deReport.rscmdVolumeRepByDate.State <> adStateOpen)
DoEvents
Wend

'Load the report
Load repTransactionVolumes

Call repTransactionVolumes.ExportReport(rptKeyHTML, vstrPath &
gstr_RSP_TransVolume, True, False)

'Wait for the asynchronous process to
While repTransactionVolumes.AsyncCount > 0
DoEvents
Wend

Any insight into the use of commands in the data environment and reports would be very welcome.

Cheers
Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top