Results 1 to 8 of 8

Thread: Progress Bar

  1. #1
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146

    Angry Unanswered: Progress Bar

    I have a M$ Progress bar control on a form that throws an error at 100%. Here is my code: (Control is named "ctlProgBar")

    Form's OnTimer event:

    Private Sub Form_Timer()
    Static intCount As Integer

    intCount = intCount + 1
    ctlProgBar.Value = intCount

    If intCount = 100 Then
    DoCmd.Close acForm, "Accounts", acSaveNo
    End If

    End Sub

    Form Timer Interval: 1

    ctlProgBar's Max Set to: 100

    I get the following error: "Run-Time error: '2763': ProgCtrl returned the error: Invalid Property Setting"

    In the code, I mouseover "intCount" and I see 101... which to me seems strange because the max on the control is 100. I have a feeling this is what is throwing the error (intCount excedding the max of the prog ctrol); however, no matter how much I fiddle with the coding or values, I get the same result. Anyone have any ideas?

  2. #2
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    Private Sub Form_Timer()
    Static intCount As Integer

    intCount = intCount + 1


    If intCount = 100 Then
    DoCmd.Close acForm, "Accounts", acSaveNo
    else

    ctlProgBar.Value = intCount
    endif
    End Sub


    Does this help ?

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Have you set up the Max property of the progress bar?

  4. #4
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    No go, emiel. Still throwing the same error. And yes, I have set the max property of the progress bar control to "100".

  5. #5
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    I rearranged the code a bit to this:

    Private Sub Form_Timer()
    Static intCount As Integer

    If intCount < 100 Then
    intCount = intCount + 1
    ctlProgBar.Value = intCount

    Else
    DoCmd.Close acForm, "Accounts", acSaveNo

    End If
    End Sub

    I have gotten rid of the error and now the bar fills completely, but nothing happens when it reaches 100. A new form is supposed to open, but nothing happens.

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You havent used any Order to open a new Form, you used only the DoCmd.Close acForm, "Accounts", acSaveNo

  7. #7
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    Well, I used the following code and everything ran correctly. I'm not sure if all of the syntax is correct, but I'm happy to have working code either way. =)

    Private Sub Form_Timer()
    Static intCount As Integer

    ctlProgBar.Value = intCount

    If intCount < 100 Then
    intCount = intCount + 1

    Else
    DoCmd.Close
    DoCmd.OpenForm "Accounts", acNormal

    End If
    End Sub

  8. #8
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    Yeah hamm, thats what I realized just before you posted. Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •