Solved

Progress Bar Activex control

Posted on 2007-11-16
27
680 Views
Last Modified: 2013-11-27
I am attempting to use the ActiveX Progress bar and Not sure how to incorporated in my code so that it will loop thru until the code ends.

Private Sub cmdProgramLevel_Click()
    Me.ProgressBar5.Visible = True
    ProgressBar5.Max = 100
    ProgressBar5.Min = 1
    ProgressBar5.Value = ProgressBar5.Min
   
    For i = 1 To ProgressBar5.Max - ProgressBar5.Min
        ProgressBar5.Value = ProgressBar5.Value + 1
        Sleep 50
        DoEvents
        D = 0
        E = 2
    Next
        Do Until rs.EOF
           gPrgID = rs.Fields("Program_ID").Value
           rs.MoveLast
        Loop
        DoCmd.OpenForm "frmLookup", acNormal, , , acFormEdit, acHidden
        OpenWS_DE
        DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal

End Sub  

Thanks,

K
0
Comment
Question by:Karen Schaefer
  • 14
  • 10
  • 2
  • +1
27 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 20302307
Not tested but try this way:
Private Sub cmdProgramLevel_Click()

    Me.ProgressBar5.Visible = True

    ProgressBar5.Max = 100

    ProgressBar5.Min = 1

    ProgressBar5.Value = ProgressBar5.Min

    DoEvents
 

    For i = 1 To (ProgressBar5.Max - 1)

        ProgressBar5.Value = ProgressBar5.Value + 1

        Sleep 50

        DoEvents

        'D = 0 - don't know what it this

        'E = 2 - don't know what it this

    Next
 

        Do Until rs.EOF

           gPrgID = rs.Fields("Program_ID").Value

           rs.MoveLast

        Loop

        DoCmd.OpenForm "frmLookup", acNormal, , , acFormEdit, acHidden

        OpenWS_DE

        DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal
 

End Sub  

Open in new window

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 20302311
This is only to improve the UI because it doesn't show the real time of the process!
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20303055
Place this in your General Modules:

Option Compare Database
Option Explicit
Dim iAccumulatedProgress As Integer


Public Sub CloseProgress()
    '******************
    '* Close the form *
    '******************
   
    DoCmd.Close acForm, "frmActiveX_Progress"
    DBEngine.Idle dbRefreshCache
   
   
End Sub

Public Sub InitProgress(strTitle As String, bolShowCancel As Boolean, intMax As Integer)
    '***************************************************************************************
    '* Use values passed from the calling form to initialize the frmActiveX_Progress form. *
    '***************************************************************************************
    On Error GoTo Init_err
    '*****************
    '* Open the form *
    '*****************
    DoCmd.OpenForm "frmActiveX_Progress"
    '**************************************
    '* Set the form InitProgress property *
    '**************************************
    iAccumulatedProgress = 0
    Forms("frmActiveX_Progress").InitProgress(bolShowCancel, intMax) = strTitle
   
Init_bye:
    Exit Sub
Init_err:
    If IsLoaded("frmActiveX_Progress") Then
        CloseProgress
    End If
    Resume Init_bye
End Sub

Function UpdateProgress(intValue As Integer) As Boolean
    '**********************************************************
    '* This procedure sets the UpdateProgress property of the *
    '* frmActiveX_Progress form.                              *
    '**********************************************************
    On Error GoTo Update_err
    iAccumulatedProgress = iAccumulatedProgress + intValue

    Forms("frmActiveX_Progress").UpdateProgress = iAccumulatedProgress
    If Forms("frmActiveX_Progress").Cancelled Then
        ' If the user clicked the Cancel button on the frmProgressBarExample form,
        ' then close the form.
        CloseProgress
        UpdateProgress = False
    Else
        UpdateProgress = True
        DBEngine.Idle dbRefreshCache
    End If
   
Update_bye:
    Exit Function
Update_err:
    If IsLoaded("frmActiveX_Progress") Then
        CloseProgress
    End If
    Resume Update_bye
End Function


************************
************************
************************

Place this where the records are being processed; either a form module or a general module:

        '***************************
        '* Count the merge records *
        '***************************
        Set rs = dbs.OpenRecordset(sTheMergeTableName, dbOpenDynaset)
        With rs
            .MoveLast
            iMergeRecordCount = .RecordCount
            .Close
        End With
        '********************************
        '* Open the progress meter form *
        '********************************
        InitProgress "The letters are currently merging with the data.", False, iMergeRecordCount
       
        '*********************
        '* Do the mail merge *
        '*********************
        wdDoc.MailMerge.Execute
       
        '*********************************
        '* Close the progress meter form *
        '*********************************
        CloseProgress


************************
************************
************************
THE FORM STUFF:

The form that contains the axtivex control will also have two text fields that can be place above or below the activex control:

I named the form: frmActiveX_Progress
I named the controls: lblProgressItemWorking and lblProgressStatus.
I named the activex control: Progress1
                     activex control OLE CLASS: ProgCtrl
I named the cancel command button: cmdCancel

I had a Cancel button under the activex control.

In the form module, I had this code:

Option Compare Database
Option Explicit
'****************************************************************************************
'* Global variable used to determine if the user cancelled the progress form operation. *
'****************************************************************************************
Dim gfCancel As Boolean

Property Let InitProgress(bolShowCancel As Boolean, intMax As Integer, strCaption As String)
    '**********************************************************************************
    '* The arguments to this property are used to set the initial values of this form *
    '**********************************************************************************
    With Me
        !lblProgressStatus.Caption = "0% Complete"
        !lblProgressItemWorking.Caption = strCaption
        !Progress1.Max = intMax
        !Progress1.SetFocus
        !cmdCancel.Visible = bolShowCancel
    End With
     
    gfCancel = False
     
   
    'DoCmd.RepaintObject acForm, "frmActiveX_Progress"
    DoCmd.RepaintObject
   
   
   
End Property

Property Let UpdateProgress(intValue As Integer)
    '********************************************************************************
    '* This property actually updates the value of the ProgressBar control and      *
    '* updates the information displayed in the label above the ProgressBar control.*
    '********************************************************************************
   
    On Error Resume Next
   
    With Me
        !Progress1.Value = intValue
        !lblProgressStatus.Caption = Format$((intValue / !Progress1.Max) * 100, "##") & "% Complete"
    End With
   
    'DoCmd.RepaintObject acForm, "frmActiveX_Progress"
    DoCmd.RepaintObject


End Property

Property Get Cancelled() As Boolean
    ' Cancelled property set to global flag value.
    Cancelled = gfCancel
End Property

Private Sub cmdCancel_Click()
    '*********************************************************************
    '* Set the flag to indicate that the user clicked the cancel button. *
    '*********************************************************************
    gfCancel = True
End Sub


Good Luck !!!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 20303137
kfschaefer1,

Do you HAVE to use the Active-x control?

If you are open to other alternatives, here are a few:

http://www.granite.ab.ca/access/progressbar.htm
http://support.microsoft.com/kb/304581

Using the Status bar
http://support.microsoft.com/kb/210474


HTH

JeffCoachman
0
 

Author Comment

by:Karen Schaefer
ID: 20313381
Lenny,

Thanks for the info, however, I am still confused on how to incorporate my current code into the progrss bar code.  My current form has 4 different buttons and it is on the activation of theses buttons that I want to affect the progress bar on my form.  Your code is currently doing something with merge documents and not using recordsetts to included in my code.  I have attached my forms current code could you please modify 1 of my samples to illustrate where and how to place the activate progress bar code.
Private Sub cmdAPLevel_Click()

    D = 1

    E = 1

    If gPrgID <> 0 Then

        GoTo ResumeNext1

    Else

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext1

        Loop

ResumeNext1:

        DoCmd.OpenForm "frmLookup_Ap", acNormal, , , acFormEdit, acDialog

    End If

    If isFormLoaded("frmMessage_Ws") Then

        DoCmd.Close acForm, "frmMessage_WS", , acSaveNo

    End If

End Sub
 

Private Sub cmdProgramLevel_Click()

        D = 0

        E = 2

        Do Until rs.EOF

           gPrgID = rs.Fields("Program_ID").Value

           rs.MoveLast

        Loop

        DoCmd.OpenForm "frmLookup", acNormal, , , acFormEdit, acHidden

        OpenWS_DE

        DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        DoCmd.Close acForm, "frmMessage_WS", , acSaveNo

    End If

End Sub
 

Private Sub cmdWSOnly_Click()

    E = 3

    If gPrgID <> 0 Then

        GoTo ResumeNext2

    Else

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext2

        Loop

    End If

ResumeNext2:

    OpenWS_DE

    DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        DoCmd.Close acForm, "frmMessage_WS", , acSaveNo

    End If
 

End Sub

Open in new window

0
 

Author Comment

by:Karen Schaefer
ID: 20313416
Lenny,

Can the progress bar be on the same form as the button form or does it have to be a separate form?

k
0
 

Author Comment

by:Karen Schaefer
ID: 20322481
Still Looking for answer
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20322693
It can be on the same form
0
 

Author Comment

by:Karen Schaefer
ID: 20322702
Then How to incorporated into my code above since I do not have a real recordset to count, how do I fire it off and shut it down.

k
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20322807

   '********************************
        '* Open the progress meter form *
        '********************************
        InitProgress "The counting is on-going message.", False, ProgressBar5.Max - ProgressBar5.Min

iAccumulatedProgress = ProgressBar5.Value + 1


I hope this clears it up!
0
 

Author Comment

by:Karen Schaefer
ID: 20322936
it does not like "iAccumulatedProgress = ProgressBar5.Value + 1" - object value not found - verified that the iAccumulatedProgress  is dim  properly.

What am I missing.

k
0
 

Author Comment

by:Karen Schaefer
ID: 20322953
here is a sample - note that I change the name of the form to a variable since I want to use this on different forms.
Private Sub cmdProgramLevel_Click()

        

        stProgressFrmName = "frmMessage_Ws"

        InitProgress "Retrieving Program Level Data!", False, ProgressBar5.Max - ProgressBar5.Min

        iAccumulatedProgress = ProgressBar5.Value + 1

        D = 0 'Flags determining which code is activated

        E = 1 'Flags determining which code is activated

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext

        Loop

ResumeNext:

        DoCmd.OpenForm "frmLookup", acNormal, , , acFormEdit, acHidden

        OpenWS_DE

        stLinkCriteria = gWSNo

        DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        CloseProgress

    End If

End Sub

Open in new window

0
 

Author Comment

by:Karen Schaefer
ID: 20323212
since I am using the same form that contains the button that executes the Progress bar (on same form) how does this work"

        stProgressFrmName = "frmMessage_Ws"
        InitProgress "Retrieving Program Level Data!", False, ProgressBar5.Max - ProgressBar5.Min
        iAccumulatedProgress = ProgressBar5.Value + 1

I realized I left off the property info on the new form.  Once I added "Property Let InitProgress" it breaks on InitProgress
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:Karen Schaefer
ID: 20323237
getting Invalid Property error on InitProgress
Option Compare Database

Option Explicit

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

'* Global variable used to determine if the user cancelled the progress form operation. *

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

Dim gfCancel As Boolean
 

Property Let InitProgress(bolShowCancel As Boolean, intMax As Integer, strCaption As String)

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

    '* The arguments to this property are used to set the initial values of this form *

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

    With Me

        !lblProgressStatus.Caption = "0% Complete"

        !lblProgressItemWorking.Caption = strCaption

        !ProgressBar5.Max = intMax

        !ProgressBar5.SetFocus

        !cmdCancel.Visible = bolShowCancel

    End With

     

    gfCancel = False

    DoCmd.RepaintObject

End Property
 

Property Let UpdateProgress(intValue As Integer)

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

    '* This property actually updates the value of the ProgressBar control and      *

    '* updates the information displayed in the label above the ProgressBar control.*

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

    

    On Error Resume Next

    

    With Me

        !ProgressBar5.Value = intValue

        !lblProgressStatus.Caption = Format$((intValue / !ProgressBar5.Max) * 100, "##") & "% Complete"

    End With

    DoCmd.RepaintObject

End Property
 

Property Get Cancelled() As Boolean

    ' Cancelled property set to global flag value.

    Cancelled = gfCancel

End Property
 

Private Sub cmdCancel_Click()

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

    '* Set the flag to indicate that the user clicked the cancel button. *

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

    gfCancel = True

End Sub
 

Private Sub Command13_Click()

On Error GoTo Err_Command13_Click

    

    DoCmd.Close
 

Exit_Command13_Click:

    Exit Sub
 

Err_Command13_Click:

    MsgBox Err.Description

    Resume Exit_Command13_Click

    

End Sub
 

Private Sub cmdAPLevel_Click()

    stProgressFrmName = "frmMessage_Ws"

    InitProgress "Retrieving Airplane Level Data!", False, ProgressBar5.Max - ProgressBar5.Min

    iAccumulatedProgress = ProgressBar5.Value + 1

    D = 1

    E = 1

    If gPrgID <> 0 Then

        GoTo ResumeNext1

    Else

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext1

        Loop

    End If

ResumeNext1:

        If gAPNo_1 = gAPNo Then

           ' GoTo ResumeNext:

            gPrgID = 0

        Else

            gPrgID = 0

            strSQL = "SELECT A.Program_ID, TA_AirplaneInfo.ApNo, TA_AirplaneInfo.ApDbms_Db" & _

                    " FROM" & _

                    "(SELECT TA_Program.Program_ID, TA_Program_Plane_Assignment.PlaneNo" & _

                        " FROM TA_Program INNER JOIN TA_Program_Plane_Assignment ON" & _

                        " TA_Program.Program_ID = TA_Program_Plane_Assignment.Program_ID" & _

                    " ) AS A" & _

                    " LEFT JOIN TA_AirplaneInfo ON A.PlaneNo = TA_AirplaneInfo.CtrAirplaneInfo" & _

                    " WHERE (TA_AirplaneInfo.ApNo=" & Chr(39) & gAPNo & Chr(39) & ")" & _

                    " ORDER BY TA_AirplaneInfo.ApNo"

        End If

        Set rs = CurrentDb.OpenRecordset(strSQL)

        Do Until rs.EOF

            gAPFilePath = rs.Fields("ApDbms_Db").Value

            CurrentDb.Execute ("Delete *" & _

                            " FROM TA_FTIR_Main")

            UpdateFTIR

            rs.MoveNext

        Loop

        DoCmd.OpenForm "frmMessage"

        Forms!frmMessage.lblMsg.Caption = _

            "PLEASE WAIT WHILE THE SYSTEM REFRESHES THE FTIR M/N LISTINGS."

        DoCmd.RepaintObject acForm, "frmMessage"
 

        CurrentDb.Execute ("Delete * from  tblFTIR_Temp")

        CurrentDb.Execute ("INSERT INTO tblFTIR_Temp" & _

            " SELECT * FROM TA_FTIR_Main_Crosstab")

        

        DoCmd.OpenQuery "qry_UpdateTblFTIR_Temp"

        strSQL = "SELECT TA_WS_FTIR.FTIR_MeasNo" & _

                " FROM TA_WS_FTIR INNER JOIN tblFTIR_Temp ON TA_WS_FTIR.FTIR_MeasNo = tblFTIR_Temp.FTIR_MeasNo"

        Set rs = CurrentDb.OpenRecordset(strSQL)

        rs.MoveFirst

        Do Until rs.EOF

            gFld = rs.Fields("FTIR_MeasNo").Value

            strSQL1 = "Select * from tblFTIR_Temp where FTIR_MeasNo =" & Chr(39) & gFld & Chr(39) & ""

            Set rs1 = CurrentDb.OpenRecordset(strSQL1)

                'rs1.MoveFirst

                Do Until rs1.EOF

                    For X = 1 To 10

                        If rs1.Fields("AP" & X).Value = 1 Then

                            rs1.Edit

                            rs1.Fields("AP" & X).Value = 2

                            rs1.Update

                        End If

                    Next

                    rs1.MoveNext

                Loop

            rs.MoveNext

        Loop

    OpenWS_DE

    DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        CloseProgress

    End If

End Sub
 

Private Sub cmdProgramLevel_Click()

Me.ProgressBar5.Visible = True

Me.lblProgressItemWorking.Visible = True

Me.lblProgressStatus.Visible = True

   

        stProgressFrmName = "frmMessage_Ws"

        InitProgress "Retrieving Program Level Data!", False, ProgressBar5.Max - ProgressBar5.Min

        iAccumulatedProgress = ProgressBar5.Value + 1

        D = 0 'Flags determining which code is activated

        E = 1 'Flags determining which code is activated

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext

        Loop

ResumeNext:

        DoCmd.OpenForm "frmLookup", acNormal, , , acFormEdit, acHidden

        OpenWS_DE

        stLinkCriteria = gWSNo

        DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        CloseProgress

    End If

End Sub
 

Private Sub cmdWSOnly_Click()

    stProgressFrmName = "frmMessage_Ws"

    InitProgress "Retrieving WS Level Data!", False, ProgressBar5.Max - ProgressBar5.Min

    iAccumulatedProgress = ProgressBar5.Value + 1

    E = 3

    If gPrgID <> 0 Then

        GoTo ResumeNext

    Else

        Do Until rs.EOF

            gPrgID = rs.Fields("Program_ID").Value

            rs.MoveLast

            GoTo ResumeNext

        Loop

    End If

ResumeNext:

    OpenWS_DE

    DoCmd.OpenForm stDocName, acNormal, , , acFormEdit, acWindowNormal

    If isFormLoaded("frmMessage_Ws") Then

        CloseProgress

    End If
 

End Sub
 

Private Sub Form_Open(Cancel As Integer)

Me.ProgressBar5.Visible = False

Me.lblProgressItemWorking.Visible = False

Me.lblProgressStatus.Visible = False

End Sub
 
 

'============Progress Bar Module ================
 

Option Compare Database

Option Explicit

Dim iAccumulatedProgress As Integer
 
 

Public Sub CloseProgress()

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

    '* Close the form *

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

    

    DoCmd.Close acForm, stProgressFrmName

    DBEngine.Idle dbRefreshCache

    

    

End Sub
 

Public Sub InitProgress(strTitle As String, bolShowCancel As Boolean, intMax As Integer)

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

    '* Use values passed from the calling form to initialize the stProgressFrmName form. *

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

    On Error GoTo Init_err

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

    '* Open the form *

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

    DoCmd.OpenForm stProgressFrmName

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

    '* Set the form InitProgress property *

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

    iAccumulatedProgress = 0

    Forms(stProgressFrmName).InitProgress(bolShowCancel, intMax) = strTitle

    

Init_bye:

    Exit Sub

Init_err:

'    If isFormLoaded(stProgressFrmName) Then

'        CloseProgress

'    End If

    Resume Init_bye

End Sub
 

Function UpdateProgress(intValue As Integer) As Boolean

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

    '* This procedure sets the UpdateProgress property of the *

    '* stProgressFrmName form.                              *

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

    On Error GoTo Update_err

    iAccumulatedProgress = iAccumulatedProgress + intValue
 

    Forms(stProgressFrmName).UpdateProgress = iAccumulatedProgress

    If Forms(stProgressFrmName).Cancelled Then

        ' If the user clicked the Cancel button on the frmProgressBarExample form,

        ' then close the form.

        CloseProgress

        UpdateProgress = False

    Else

        UpdateProgress = True

        DBEngine.Idle dbRefreshCache

    End If

    

Update_bye:

    Exit Function

Update_err:

    If isFormLoaded(stProgressFrmName) Then

        CloseProgress

    End If

    Resume Update_bye

End Function

Open in new window

0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20323294
Progress1 is the name of the activex control on your form
lblProgressStatus is a label on the form
lblProgressItemWorking is a label on the form

The code below is the code behind your form
Option Compare Database

Option Explicit

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

'* Global variable used to determine if the user cancelled the progress form operation. *

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

Dim gfCancel As Boolean
 

Property Let InitProgress(bolShowCancel As Boolean, intMax As Integer, strCaption As String)

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

    '* The arguments to this property are used to set the initial values of this form *

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

    With Me

        !lblProgressStatus.Caption = "0% Complete"

        !lblProgressItemWorking.Caption = strCaption

        !Progress1.Max = intMax

        !Progress1.SetFocus

        !cmdCancel.Visible = bolShowCancel

    End With

     

    gfCancel = False

     

    

    'DoCmd.RepaintObject acForm, "frmActiveX_Progress"

    DoCmd.RepaintObject

    

    

    

End Property
 

Property Let UpdateProgress(intValue As Integer)

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

    '* This property actually updates the value of the ProgressBar control and      *

    '* updates the information displayed in the label above the ProgressBar control.*

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

    

    On Error Resume Next

    

    With Me

        !Progress1.Value = intValue

        !lblProgressStatus.Caption = Format$((intValue / !Progress1.Max) * 100, "##") & "% Complete"

    End With

    

    'DoCmd.RepaintObject acForm, "frmActiveX_Progress"

    DoCmd.RepaintObject
 
 

End Property
 

Property Get Cancelled() As Boolean

    ' Cancelled property set to global flag value.

    Cancelled = gfCancel

End Property
 

Private Sub cmdCancel_Click()

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

    '* Set the flag to indicate that the user clicked the cancel button. *

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

    gfCancel = True

End Sub

Open in new window

0
 
LVL 10

Accepted Solution

by:
LennyGray earned 500 total points
ID: 20323307
The following code goes into your general modules in a name of your choosing
Option Compare Database

Option Explicit

Dim iAccumulatedProgress As Integer
 
 

Public Sub CloseProgress()

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

    '* Close the form *

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

    

    DoCmd.Close acForm, "frmActiveX_Progress"

    DBEngine.Idle dbRefreshCache

    

    

End Sub
 

Public Sub InitProgress(strTitle As String, bolShowCancel As Boolean, intMax As Integer)

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

    '* Use values passed from the calling form to initialize the frmActiveX_Progress form. *

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

    On Error GoTo Init_err

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

    '* Open the form *

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

    DoCmd.OpenForm "frmActiveX_Progress"

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

    '* Set the form InitProgress property *

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

    iAccumulatedProgress = 0

    Forms("frmActiveX_Progress").InitProgress(bolShowCancel, intMax) = strTitle

    

Init_bye:

    Exit Sub

Init_err:

    If IsLoaded("frmActiveX_Progress") Then

        CloseProgress

    End If

    Resume Init_bye

End Sub
 

Function UpdateProgress(intValue As Integer) As Boolean

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

    '* This procedure sets the UpdateProgress property of the *

    '* frmActiveX_Progress form.                              *

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

    On Error GoTo Update_err

    iAccumulatedProgress = iAccumulatedProgress + intValue

    'Debug.Print "UpdateProgress: " & iAccumulatedProgress

    Forms("frmActiveX_Progress").UpdateProgress = iAccumulatedProgress

    If Forms("frmActiveX_Progress").Cancelled Then

        ' If the user clicked the Cancel button on the frmProgressBarExample form,

        ' then close the form.

        CloseProgress

        UpdateProgress = False

    Else

        UpdateProgress = True

        DBEngine.Idle dbRefreshCache

    End If

    

Update_bye:

    Exit Function

Update_err:

    If IsLoaded("frmActiveX_Progress") Then

        CloseProgress

    End If

    Resume Update_bye

End Function

Open in new window

0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20323378
The following code goes where you are incrementt he progress bar (usually upon processing a record

Update progress is simply a functionthattakes the integer "1" when a record is processed (in your case a form )
        '********************************

        '* Open the progress meter form *

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

        InitProgress "The letters are currently merging with the data.", False, iMergeRecordCount

Open in new window

0
 

Author Comment

by:Karen Schaefer
ID: 20323434
sorry to be so dense, but that is what I have on my form

My form Name is FrmMessage_WS
Contains 5 buttons
Each button should activate the progress bar on click of the button and finish bar on completion of code

the progress bar name = ProgressBar5 is the name of the activeX

it still does not like the Init Progress - invalid object.

as displayed above in the code snippet I posted @ 01:07PM - has all my code.  Please feel free to modify to assist me in getting this thing to work.

Thanks for all your time.

K
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20323554
Without going into a deep debug.....

make sure that all of your references to screen control values have either Me!Progress.Max or a Forms!FormName!ControlName.

e.g.

   iAccumulatedProgress = ProgressBar5.Value + 1
s/b
   iAccumulatedProgress = Me!ProgressBar5.Value + 1

and
        InitProgress "Retrieving Program Level Data!", False, ProgressBar5.Max - ProgressBar5.Min
s/b
        InitProgress "Retrieving Program Level Data!", False, Me!ProgressBar5.Max - Me!ProgressBar5.Min


Etc.

Check all of your typing of field references throughout by doing a "find" on each name.

One slip-up will kill you.

I forgot more mistakes than you will ever make.



See if that does it.
0
 

Author Comment

by:Karen Schaefer
ID: 20323672
I made sure to change to the me!progressbar5 and I am still getting the invalid property on the InitProgress - after looking at the help are you sure it should be set as Property Let and not Property Get or Property Set.

K
0
 

Author Comment

by:Karen Schaefer
ID: 20323705
notice that the format of the Let statement differs from the actual statement - could this be the issue?

Property Let InitProgress(bolShowCancel As Boolean, intMax As Integer, strCaption As String)

Where as the actual InitProgress = "Caption", Cancel, boolean" if I am not mistaken?

k
0
 

Author Comment

by:Karen Schaefer
ID: 20323764
Could it be that the Property Let and the Module names are the same?

k
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20323927
maybe. They are objects.

Try changing it.
0
 

Author Comment

by:Karen Schaefer
ID: 20324082
tried  it but didn't solve the issue.  I have given up on this can't spend my whole day trying to get this working.

Thanks, for all your efforts.

K
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20324098
we both spent a lot of time on this. I am sorry that you were unable to make it work. I also work for a living and gave you valuable time because i also have been in these predicaments.

I wish you well.
0
 

Author Comment

by:Karen Schaefer
ID: 20324115
I REALLY APPRECIATE YOUR TIME AND HAVE A GREAT THANKSGIVING WEEKEND.

HAPPY TURKEY DAY.

K
0
 
LVL 10

Expert Comment

by:LennyGray
ID: 20324223
You , too!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

708 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

18 Experts available now in Live!

Get 1:1 Help Now