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!

Subform displayed data does not update as data updates 1

Status
Not open for further replies.

jryan3

Technical User
May 18, 2001
18
US
I have a form with a subform. The user selects a button on the form to cause data to be transferred from another database to the current database. The data transfer is divided into sections based on certain criteria. The subform is used to show the progress of the transfer. Each time a section of the data is successfully transferred, fields on the subform are updated to reflect the progress. The problem is that the progress data that the user sees is not upated until the transfer of the data for all sections has been completed. I have used breakpoints to confirm that the code used to update the progress is actually executed when expected.
What code can I use to force the displayed subform data to update when each section is updated as opposed to being queued until after the entire transfer for all sections has completed?
Below is the code used to update the transfer progress.
Code:
       rstCurrent.MoveFirst ' go to first record in table
       Do While True  ' Loop through the whole list of Baselines, Elements and Programs of Interest
          If rstCurrent.EOF Then
          'MsgBox "End of the list of Baselines, Elements and Programs of Interest!"
             Exit Do
          Else
             myBaseline = rstCurrent!Baseline
             myElement = rstCurrent!Element
             myProgram = rstCurrent!Program
             strBaselineElementProgram = rstCurrent!Baseline & "-" & rstCurrent!Element & "-" & rstCurrent!Program
             
             'Record the time that the download began
             rstCurrent.Edit
             rstCurrent!DownloadStartTime = Now()
             rstCurrent.Update
             strDownloadStartTime = PutDownloadStartTime(rstCurrent!DownloadStartTime)
             PutCurrentBaseElemProg (strBaselineElementProgram)
             strDownloadCompletedTime = "" ' Blank out the completed Time
             Forms!frm_Start_the_Database!frmDownloadProgress!txtCurrentBaseElemProg.Value = strBaselineElementProgram
             Forms!frm_Start_the_Database!frmDownloadProgress!txtDownloadStartTime.Value = strDownloadStartTime
             Forms!frm_Start_the_Database!frmDownloadProgress!txtDownloadCompletedTime.Value = strDownloadCompletedTime
             Forms!frm_Start_the_Database!frmDownloadProgress!txtRemainingCombos.Value = longRemainingRecordsToProcess
             Forms!frm_Start_the_Database!frmDownloadProgress.Requery
             'MsgBox "A new baseline/element/program combination is being processed."

             strStatus = GetAIMSData(myBaseline, myElement, myProgram)
             'Check for an error in the transfer
             If strStatus = GetTransferFailed Then
                Resume Err_GetAIMSDataForBaselinesOfInterest
             End If
             
             'Record the time that the download completed
             rstCurrent.Edit
             rstCurrent!DownloadCompletedTime = Now()
             rstCurrent.Update
             strDownloadCompletedTime = PutDownloadCompletedTime(rstCurrent!DownloadCompletedTime)
             PutCurrentBaseElemProg (strBaselineElementProgram)
             Forms!frm_Start_the_Database!frmDownloadProgress!txtCurrentBaseElemProg.Value = strBaselineElementProgram
             Forms!frm_Start_the_Database!frmDownloadProgress!txtDownloadStartTime.Value = strDownloadStartTime
             Forms!frm_Start_the_Database!frmDownloadProgress!txtDownloadCompletedTime.Value = strDownloadCompletedTime
             longRemainingRecordsToProcess = longRemainingRecordsToProcess - 1
             Forms!frm_Start_the_Database!frmDownloadProgress!txtRemainingCombos.Value = longRemainingRecordsToProcess
             Forms!frm_Start_the_Database!frmDownloadProgress.Requery

             
             'MsgBox "The new baseline/element/program combination was processed."
             rstCurrent.MoveNext
          End If
       Loop
Joe
 
You may consider the DoEvents function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,
Thanks for the help! The DOEvents solved my problem.

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top