Solved

Run the procces bar when i want to import a data base

Posted on 1997-11-28
1
208 Views
Last Modified: 2012-06-27
how i could active a activeX control (the proccess bar ) in my form when i want  to import a data base . I want start to run the proccess bar.
What code i do?
0
Comment
Question by:cbrart0
1 Comment
 
LVL 5

Accepted Solution

by:
cekman earned 20 total points
ID: 1961002
The following is a copy of the text from Microsoft Knowledge base article Q174026 - this should give you all the information you need.

Good Luck!
CEkman

ARTICLE FOLLOWS:


ODE: How to Use the ProgressBar ActiveX Control
Article ID: Q174026  
The information in this article applies to:
Microsoft Office 97 Developer Edition Tools


SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.

You can use a ProgressBar control to show an operation's progress toward completion. A ProgressBar control has a range and a current position. This article demonstrates how you can use the Max, Min, and Value properties of the ProgressBar Control within a Microsoft Access 97 Database.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.



MORE INFORMATION

  1. Start Microsoft Access 97 and open any database.

  2. In the Database window, click the Forms tab, and then click New to
     create a new form not based on any table or query.

  3. On the File menu, click Save As/Export, and save the form as
     frmProgressBar.

  4. Add three unbound text boxes to the frmProgressBar form, and set their
     properties as follows:

       Name: txtMin
       Default Value: 10
       Validation Rule: Is Not Null
       Validation Text: Please Enter a Numerical Value

       Name: txtMax
       Default Value: 5000
       Validation Rule: Is Not Null
       Validation Text: Please Enter a Numerical Value

       Name: txtStep
       Default Value: 10
       Validation Rule: Is Not Null
       Validation Text: Please Enter a Numerical Value

  5. On the Insert menu, click ActiveX Control and insert the Microsoft
     ProgressBar Control, version 5.0. Set its properties as follows:

       Name: CtlProgress
       Width: 1.95
       Height: .15

  6. Add two command buttons, and set their properties as follows:

       Name: cmdRun
       Caption: Run

       Name: cmdClear
       Caption: Clear

  7. Insert a label, and set its properties as follows:

       Name: lblComplete
       Caption: 0% Complete
       Visible: No

  8. Using the right mouse button (right-click), click the Run command
     button, and then click Build Event on the menu that appears.

  9. In the Choose Builder dialog box, click Code Builder, and then click
     OK.

 10. Type the following event procedure in the Module window:

       Private Sub cmdRun_Click()

          Dim prg As ProgressBar
          Dim IntValue As Long
          Dim fmin As TextBox, fmax As TextBox, fstep As TextBox
          Dim strComplete As String
          Dim Complete As Label

          Set fmin = Forms!frmProgressBar!txtMin
          Set fmax = Forms!frmProgressBar!txtMax
          Set fstep = Forms!frmProgressBar!txtStep
          Set prg = Me!CtlProgress.Object
          Set Complete = Me!lblComplete

          ' If the txtMin textbox contains a non-numeric value
          ' or a number less than 0, force the user to
          ' re-enter data in correct format.

          If Val(fmin) <= 0 Then
             MsgBox "Please enter a positive numerical value above 0 " & _
                "in the Minimum text box."
             fmin = Null
             fmin.SetFocus
             Exit Sub
          End If

          ' If the txtMax text box contains a non-numeric
          ' value or a number less than the value in txtMin,
          ' force the user to re-enter data in correct format.

          If Val(fmax) <= 0 Or Val(fmax) <= fmin Then
             MsgBox "Please enter a positive numerical value above " & _
                fmin & " in the  Maximum textbox."
             fmax = Null
             fmax.SetFocus
             Exit Sub
          End If

          ' If txtStep contains a non-numeric value or a number less
          ' than 1, force the user to re-enter data in correct format.

          If Val(fstep) < 1 Then
             MsgBox "Please enter a number less than or equal " & _
                "to 1 in the Step text box."
             fstep = Null
             fstep.SetFocus
             Exit Sub
          End If

          ' The maximum value for the MAX property of a progress bar
          ' is 10,000; if the number entered in txtMax is over 10,000,
          ' set the MAX property to 10,000. Otherwise, set the MAX
          ' property to whatever the user has entered.

          If fmax > 10000 Then
             prg.Max = 10000
          Else
             prg.Max = fmax
          End If

          ' The maximum value for the MIN property of a progress bar
          ' is also 10,000; if the number entered in txtMin is
          ' greater than 10,000, set the MIN property to 9,999
          ' so it is still less than the MAX property. Otherwise,
          ' set the MIN property to whatever the user has entered.

          If fmin > 10000 Then
             prg.Min = 9999
          Else
             prg.Min = fmin
          End If

          IntValue = fmin

          ' Increment the progress bar and % complete label as long as the
          ' Value assigned to it is less than or equal to the MAX property
          ' of the progress bar.

          Complete.Visible = True

          Do
             IntValue = IntValue + Me!txtStep
             If IntValue >= prg.Max Then
                IntValue = prg.Max
             End If
             prg.Value = IntValue
             strComplete = Format((prg.Value / prg.Max) * 100, "##") & _
                  " % Complete"
             Complete.Caption = strComplete
             DoCmd.RepaintObject
          Loop While IntValue < prg.Max

       End Sub

 11. Using the right mouse button (right-click), click the Clear command
     button, and then click Build Event on the menu that appears.

 12. In the Choose Builder dialog box, click Code Builder, and then click
     OK.

 13. Type the following event procedure in the module window:

       Private Sub cmdClear_Click()

          Dim prg As ProgressBar
          Dim Complete As Label

          Set prg = Me!CtlProgress.Object
          Set Complete = Me!lblComplete

          ' Clear the Progress Bar by setting its value to the
          ' Control's MIN property; then hide the Complete label.

          prg.Value = prg.Min
          Complete.Visible = False

       End Sub

 14. On the Debug menu, click Compile Loaded Modules.

 15. Save the form, and then switch to Form View.

 16. Click Run.

     Note that the ProgressBar fills while the label control shows the
     progress as a percentage.
 

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

Suggested Solutions

Title # Comments Views Activity
data analyst 3 50
Is it possible to reset DSum? 12 44
append to an ms access field 6 26
Export to flat file from Access 2003, not using saved spec 9 0
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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

863 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

27 Experts available now in Live!

Get 1:1 Help Now