Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PROGRESS BAR

Posted on 1998-01-15
4
Medium Priority
?
462 Views
Last Modified: 2008-03-06
Is it possible to have a progress bar displayed on the screen to let the user know that something is happening?
0
Comment
Question by:JGWYNN
[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
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
Trygve earned 60 total points
ID: 1965618
Make use of a counter. Either to count as you proceed through the records in a table or as your code moves from one part to another.

Example

Counter=1
' Do some initialising settings to a table
Counter=2
' Set fields according to selected values on the form
Counter=3
' Sending output to printer
...

To initialize the progress bar, setting explaining text and maximum value for the counter
Junk = SysCmd(SysCmd_InitMeter, "Text", MaxValue)

Setting the Progress bar using the counter value
Junk = SysCmd(SysCmd_UpdateMeter, CounterValue)

Removing the progress bar when finished
Junk = SysCmd(SysCmd_RemoveMeter)


PS: See help file for the SysCmd. It can do a lot of cool stuff !
Hope this helps !
Trygve
0
 
LVL 12

Expert Comment

by:Trygve
ID: 1965619
When using Access'97 there might be more elegant ways of doing this.

docmd.runcommand [something]

I think the above should work, but if you want the runcommand way, I can probably find it for you later (no Access'97 on the computer I am sitting on at the moment)
0
 

Author Comment

by:JGWYNN
ID: 1965620
Can you find out the more elegant way for me while I try this one
0
 
LVL 12

Expert Comment

by:Trygve
ID: 1965621
This operation is done the same way in Access'97. However there is an ActiveX control that can be used.

Here is information that I have just copied from the help file:


------------------------
The ProgressBar control shows the progress of a lengthy operation by filling a rectangle with chunks from left to right.

Syntax

ProgressBar

Remarks

·      The ProgressBar control monitors an operation's progress toward completion.

A ProgressBar control has a range and a current position. The range represents the entire duration of the operation. The current position represents the progress the application has made toward completing the operation. The Max and Min properties set the limits of the range. The Value property specifies the current position within that range. Because chunks are used to fill in the control, the amount filled in only approximates the Value property's current setting. Based on the control's size, the Value property determines when to display the next chunk.

The ProgressBar control's Height and Width properties determine the number and size of the chunks that fill the control. The more chunks, the more accurately the control portrays an operation's progress. To increase the number of chunks displayed, decrease the control's Height or increase its Width. The BorderStyle property setting also affects the number and size of the chunks. To accommodate a border, the chunk size becomes smaller.

You can use the Align property with the ProgressBar control to automatically position it at the top or bottom of the form.

Tip   To shrink the chunk size until the progress increments most closely match actual progress values, make the ProgressBar control at least 12 times wider than its height.

The following example shows how to use the ProgressBar control, named ProgressBar1, to show the progress of a lengthy operation of a large array. Put a CommandButton control and a ProgressBar control on a form. The Align property in the sample code positions the ProgressBar control along the bottom of the form. The ProgressBar control displays no text.

Private Sub Command1_Click()
      Dim Counter As Integer
      Dim Workarea(250) As String
      ProgressBar1.Min = LBound(Workarea)
      ProgressBar1.Max = UBound(Workarea)
      ProgressBar1.Visible = True

'Set the Progress's Value to Min.
      ProgressBar1.Value = ProgressBar1.Min

'Loop through the array.
      For Counter = LBound(Workarea) To UBound(Workarea)
            'Set initial values for each item in the array.
            Workarea(Counter) = "Initial value" & Counter
            ProgressBar1.Value = Counter

Next Counter
      ProgressBar1.Visible = False
      ProgressBar1.Value = ProgressBar1.Min
End Sub

Private Sub Form_Load()
      ProgressBar1.Align = vbAlignBottom
      ProgressBar1.Visible = False
      Command1.Caption = "Initialize array"
End Sub

Distribution Note The ProgressBar control is part of a group of ActiveX controls that are found in the COMCTL32.OCX file. To use the ProgressBar control in your application, you must add the COMCTL32.OCX file to the project. When distributing your application, install the COMCTL32.OCX file in the user's Microsoft Windows System or System32 directory. For more information on how to add an ActiveX control to a project, see the Programmer's Guide.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

636 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