Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Estimated Time and Work Done

Posted on 2007-04-08
6
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses

722 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