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
'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