Solved

Estimated Time and Work Done

Posted on 2007-04-08
6
169 Views
Last Modified: 2010-04-30
I am sorry If I am wrong, But I try tol resolve problem of estimated time and work done as this is my first experience in it.

I have one Progressbar and am trying to show the work done and estimted time.
1) for display work done (Name : PRG_Done)
2) for display estimated time (Name : PRG_Est)
----------------------------------------------
If all records are read from database and written to excel means,
100% work done.
if one record read means PRG_Done value= (100 * total read records)/total recordset records.
PRG_Est value = 100 - PRG_Done.value

If any one please tell me any better idea or suggestion as i am not very expert in the progress bar.

Thanks.
0
Comment
Question by:mustish1
  • 2
  • 2
  • 2
6 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 18872744
If you set the Max value of the progress bar to 100.

PRG_Done value= (100 * total read records)/Total-recordset-records
(as you correctly have)


If you set the Max value of the progress bar to the Total-recordset-records then the progress done is just the number of records processed and the progress bat will look after the rest of it.


Estimate for total time:

Time-taken-so-far * Total-recordset-records / Records-read-so-far



Estimate for time to complete:

(Time-taken-so-far * Total-recordset-records / Records-read-so-far) - Time-taken-so-far
0
 

Author Comment

by:mustish1
ID: 18872752
Thanks. Can you please tell me how to i get the value of Time-taken-so-far ?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18872762
Does this help?

    Dim RecordCount As Integer
    Dim EstimatedTime As Date
   
    ProgressBar1.Max = RecordCount
    dtStart = Now
    For i = 1 To RecordCount

         'Read next record      

        EstimatedTime = (RecordCount - i) * (Now - dtStart) / i
        Label1.Caption = "Time left - " & Format$(EstimatedTime, "nn:ss")
        ProgressBar1.Value = i
    Next i
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

Author Comment

by:mustish1
ID: 18872934
Thanks. Can you also please tell me if there is a do while loop is running then how to i put that code into it?

do while not objrec.eof
ProgressBar1.Max = RecordCount
    dtStart = Now
    For i = 1 To RecordCount
         'Read next record      
        mDebitID =objRec.Fields(0).Value
        EstimatedTime = (RecordCount - i) * (Now - dtStart) / i
        Label1.Caption = "Time left - " & Format$(EstimatedTime, "nn:ss")
        ProgressBar1.Value = i
    Next i
objrec.movenext
loop

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 18872956
You only need one loop, which you have provided with the Do While. Just increment the record counter (i):

    ProgressBar1.Max = RecordCount
    dtStart = Now
    Do While Not objrec.EOF
         'Read next record
        mDebitID = objrec.Fields(0).Value
        i = i + 1
        EstimatedTime = (RecordCount - i) * (Now - dtStart) / i
        Label1.Caption = "Time left - " & Format$(EstimatedTime, "nn:ss")
        ProgressBar1.Value = i
        objrec.movenext
    Loop
0
 
LVL 18

Expert Comment

by:JR2003
ID: 18872965
To get the time taken so far you just need to store the current time in a date type variable when it starts and compare it to the current-time (Now()) during the process
    Dim StartTime As Date
    Dim ElapsedTime As Date
   
    StartTime = Now()

    'Do some code here that takes some some
   
    ElapsedTime = Now() - StartTime
    Debug.Print ElapsedTime
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question