Share via

Progress Meter Part 2

Anonymous
2017-09-07T08:57:19+00:00

Ok

I have found a free code out there in the internet , I think the issue of creating a form is not a problem for me here ,I have only one issue not fully covered see code 2 below :

The code below goes behind the new form which will be created again no issue here:

Option Compare Database

Option Explicit

' **************************

' * Class: Form_ProgressBar *

' * Popup progress bar *

' * *

' * Author: Christopher J. McClellan *

' * Published under Creative Commons Attribution-Share Alike *

' * http://creativecommons.org/licenses/by-sa/3.0/ *

' * You are free to change, distribute, and pretty much do *

' * whatever you like with the code, but you must give credit *

' * to the original author and publish any derivitive of this *

' * code under the same license. *

' **************************

Private Const MaxBoxWidth As Long = 7200 'maximun boxProgress width

Public Enum ePBarModeType

 PBarMode_Percent = 0

 PBarMode_Executing = 1

End Enum

Private mMode As ePBarModeType

Private mCurrentProgress As Long

Private mSteps As Long

Public Property Get PercentComplete() As Double

'read only

 PercentComplete = mCurrentProgress / mSteps * 100

End Property

Public Property Let Mode(PBarMode As ePBarModeType)

 mMode = PBarMode

End Property

Public Property Get Mode() As ePBarModeType

 Mode = mMode

End Property

Public Property Let CurrentProgress(lng As Long)

' Updating the CurrentProgress property updates the status of the Progress Bar

mCurrentProgress = lng

 ' format #0 makes a 1 or 2 digit number without decimals

 If mMode = PBarMode_Percent Then

 'format "#0" gives a 1 or 2 digit integer

 Me.txtStatus = Format(Me.PercentComplete,

 ElseIf mMode = PBarMode_Executing Then

 Me.txtStatus = "Executing..."

 End If

 ' boxProgress.Width = a percentage of maximum box width

 Me.boxProgress.Width = (mCurrentProgress / mSteps) * MaxBoxWidth

 Me.Repaint

 DoEvents

End Property

Public Property Get CurrentProgress() As Long

' current step of process

 CurrentProgress = mCurrentProgress

End Property

Property Let steps(lng As Long)

' total number of steps to process

 mSteps = lng

End Property

Public Sub init(steps As Long, Mode As ePBarModeType, Optional strCaption As String = "Loading...")

' initializes values for progress bar

Me.Mode = Mode

 Me.Caption = strCaption

 mCurrentProgress = 0

 mSteps = steps

 Me.txtStatus = "Ready"

 Me.boxProgress.Width = 0

 Me.Visible = True

End Sub

Problem:

Code two

</pre>

Private Sub exampleCall1()

' example call for using progress bar with a looping process

 Dim pbar As Form_ProgressBar

 Dim i As Long

 Dim steps As Long

 steps = 100000

 ' create new instance of Progress Bar

 Set pbar = New Form_ProgressBar

 With pbar

 ' #of steps, Mode, Caption

 .init steps, PBarMode_Percent, "Hey, I'm working here!"

 For i = 1 To steps

 ' do something in a loop

 ' update progress

 .CurrentProgress = i

 Next i

 End With

 Set pbar = Nothing

End Sub

Where should I press this code Two ????????? if it is still on the new form then how do I call this function for example from my splash form?????????????

Many thanks to the Author: Christopher J. McClellan *

Regards

Chris

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2017-09-07T13:10:47+00:00

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2017-09-07T13:13:57+00:00

    Okay, I found the source, https://christopherjmcclellan.wordpress.com/2014/03/08/progress-bar-for-ms-access/comment-page-1/ , simply follow the author's instructions if you want to use this progress bar.   He even has a download sample at the end of the article.

    Was this answer helpful?

    0 comments No comments