Solved

Estimated Time and Work Done

Posted on 2007-04-08
6
164 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now