473,626 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Use a Progress Meter in Access

ADezii
8,834 Recognized Expert Expert
Many Access Users fail to realize that it has a built-in Progress Meter that can display the relative completion percentage of various processes. It is fairly limited, but nonetheless, does provide visual feedback indicating the percent completion of a certain task. The Meter itself, when activated, rests on the left hand corner of the Status Bar and is controlled via the SysCmd() Method. It is straightforward , simple to use, and involves only 3 steps to implement it, These steps are listed below. Following these steps, a code segment involving the updating of a Field within a Recordset, will demonstrate its use.
  1. Initiate the Meter using the acSysCmdInitMet er Action Argument, descriptive text, and a Value Argument which is the Maximum Value of the Meter.
  2. Periodically update the Meter with the acSysCmdUpdateM eter Action Argument and a Value Argument indicating the relative progress of the task at hand.
  3. Remove the Meter using the acSysCmdClearSt atus.

Expand|Select|Wrap|Line Numbers
  1. 'The following code will loop through all Records in tblEmployee
  2. and Update the value in a newly created Field called [Full Name] 
  3. to [FirstName] & " " & [LastName]. The relative completion percentage 
  4. of this operation will be displayed in our Progress Meter.
  5.  
  6. Dim MyDB As DAO.Database, MyRS As DAO.Recordset
  7. Dim varReturn, intCounter As Long, dblNum, intNoOfRecs As Long
  8.  
  9. Set MyDB = CurrentDb()
  10. Set MyRS = MyDB.OpenRecordset("tblEmployee", dbOpenDynaset)
  11.  
  12. MyRS.MoveLast: MyRS.MoveFirst
  13. intNoOfRecs = MyRS.RecordCount
  14.  
  15. 'Initialize the Progress Meter, set Maximum Value = intNoOfRecs
  16. varReturn = SysCmd(acSysCmdInitMeter, "Updating...", intNoOfRecs)
  17.  
  18. Do While Not MyRS.EOF
  19.   With MyRS
  20.     .Edit
  21.       ![Full Name] = ![FirstName] & " " & ![LastName]
  22.         intCounter = intCounter + 1
  23.         'Update the Progress Meter to (intCounter/intNoOfRecs)%
  24.         varReturn = SysCmd(acSysCmdUpdateMeter, intCounter)    .Update
  25.         .MoveNext
  26.   End With
  27. Loop
  28.  
  29. 'Remove the Progress Meter
  30. varReturn = SysCmd(acSysCmdClearStatus)
  31.  
  32. MyRS.Close
NOTE: If updating a large Recordset, you may wish to periodically relinquish control to the Windows Environment using DoEvents. If anyone is interested in how to do this, please let me know,
May 12 '07 #1
23 42124
PCurtin
1 New Member
I am using syscmd for the meter....if I do not stay on the screen and go to another application, when I try to come back to the screen it does not update the meter anymore....I have the same thing with msgbox.
Aug 22 '07 #2
wassimdaccache
222 New Member
Very useful code thank you

I'm using a full screen form am I able to change the place of the update meter ? for example having it as msgbox in my form ..



I'm interesting in DoEvents because I'm using a very large recordset (more than 1000 000 records/ table ) I'm always have delay if I want to select a record in the recordset or navigate using loop ...


Can u explain for me the best way to search a value in a very large recordset ?
Does memories (ram) || cash memory || CPU frequencies || system heat are factors to change the speed of getting a value in a recordset ?
Aug 31 '07 #3
ADezii
8,834 Recognized Expert Expert
Very useful code thank you

I'm using a full screen form am I able to change the place of the update meter ? for example having it as msgbox in my form ..



I'm interesting in DoEvents because I'm using a very large recordset (more than 1000 000 records/ table ) I'm always have delay if I want to select a record in the recordset or navigate using loop ...


Can u explain for me the best way to search a value in a very large recordset ?
Does memories (ram) || cash memory || CPU frequencies || system heat are factors to change the speed of getting a value in a recordset ?
The most efficient and fastest way to search for a value in a very large Recordset is by using the Seek() Method. It must, however, be based on a Table Type Recordset. Everything you mentioned is more than likely a factor that effects the speed with which searches can be done, but one of the most critical factors, in my opinion, is whether or not the Field is Indexed.
Aug 31 '07 #4
rcollins
234 New Member
Here is the error I am getting now: "You can't reference a property or method for a control unless the control has the focus."
Here is my exact code for picking from two choises. I only get this error on the first choice, but don't get anything in the text box with the second one.
Expand|Select|Wrap|Line Numbers
  1. Private Sub StandardizedAllocation_AfterUpdate()
  2. If StandardizedAllocation.Text = "HOUSE MEETINGS:" Then StandardizedAllocationSumm.Text = "Consult with direct care staff ongoing medical concerns and plan of care."
  3. If StandardizedAllocation.Text = "MD Appt.Prep:" Then StandardizedAllocationSumm.Text = "Case file reviewed for pending medical appointment.  Plan of care reviewed and updated."
  4.  
  5. End Sub
  6.  
Oct 10 '07 #5
ADezii
8,834 Recognized Expert Expert
Here is the error I am getting now: "You can't reference a property or method for a control unless the control has the focus."
Here is my exact code for picking from two choises. I only get this error on the first choice, but don't get anything in the text box with the second one.
Expand|Select|Wrap|Line Numbers
  1. Private Sub StandardizedAllocation_AfterUpdate()
  2. If StandardizedAllocation.Text = "HOUSE MEETINGS:" Then StandardizedAllocationSumm.Text = "Consult with direct care staff ongoing medical concerns and plan of care."
  3. If StandardizedAllocation.Text = "MD Appt.Prep:" Then StandardizedAllocationSumm.Text = "Case file reviewed for pending medical appointment.  Plan of care reviewed and updated."
  4.  
  5. End Sub
  6.  
You use the Text property to set or return the text contained in a Text Box or in the text box portion of a Combo Box. It is a Read/write String. To set or return a control's Text property, the Control must have the focus, or an error occurs. If you are just concerned with setting/retrieving the value in the Control itself, then adjust your code to:
Expand|Select|Wrap|Line Numbers
  1. Private Sub StandardizedAllocation_AfterUpdate()
  2. If Me![StandardizedAllocation] = "HOUSE MEETINGS:" Then   
  3.   Me![StandardizedAllocationSumm] = "Consult with direct care staff ongoing medical concerns and plan of care."
  4. ElseIf Me![StandardizedAllocation] = "MD Appt.Prep:" Then   
  5.   Me![StandardizedAllocationSumm] = "Case file reviewed for pending medical appointment.  Plan of care reviewed and updated."
  6. Else
  7.   'not sure what you want to do here, if anything
  8. End If
  9. End Sub
Oct 10 '07 #6
rcollins
234 New Member
Awesome, sorry I posted this in the wrong place, but working on three databases at the same time. Worked perfect.
Oct 10 '07 #7
ADezii
8,834 Recognized Expert Expert
@djbit:
Hello ADezzi, I saw your article on using the access progress bar. it worked nicely thanks!

Anyways, you mentioned in the notes that you could implement this along with the DoEvents function. Can you show me how you would do that. I have a process that takes about 5-10 minutes and I think this DoEvents thing is needed.
This Logic would be used when processing very large Recordsets, which yours apparently is. In the partial Code listing below, it will periodically check the Environment ever 50,000th Iteration of the Loop. You can, of course, vary this number. Later on, I'll send you an Attachment illustrating amuch simpler, and more graphic technique, of accomplishing the same thing.
Expand|Select|Wrap|Line Numbers
  1. 'Code intentionally removed.............................................
  2. Do While Not MyRS.EOF
  3.   With MyRS
  4.     .Edit
  5.       ![Full Name] = ![FirstName] & " " & ![LastName]
  6.         intCounter = intCounter + 1
  7.           'Check the Environment every 50,0000th Iteration
  8.           If intCounter Mod 50000 Then DoEvents
  9.             'Update the Progress Meter to (intCounter/intNoOfRecs)%
  10.             varReturn = SysCmd(acSysCmdUpdateMeter, intCounter)
  11.     .Update
  12.         .MoveNext
  13.   End With
  14. Loop
  15. 'Code intentionally removed.............................................
P.S. - Got back to adding that Attachment that I was referring to.
Attached Files
File Type: zip Progress Bar.zip (16.1 KB, 1104 views)
Feb 12 '11 #8
djbit
1 New Member
ADezii, thank you very much! I will look into making this work in my application.
Feb 14 '11 #9
Narender Sagar
189 New Member
Hi ADezii,
I want to update about 4 tables (quite much data in each table) with click of a command button. And I would like to show users progress bar with respect to data uploaded in each table.
How can make use of above code for that.
I am using following codes for updating data in the tables. (I have written a very bad code- as I am still learning stage)
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.     DoCmd.Hourglass True
  3.     DoCmd.SetWarnings False
  4.     DoCmd.OpenQuery ("updateZDBCT0111")
  5.     DoCmd.OpenQuery ("updateZD008")
  6.     DoCmd.OpenQuery ("updateZD010")
  7.     DoCmd.OpenQuery ("updateZD012")
  8.     MsgBox "Data Updated"
  9.     DoCmd.Hourglass False
  10.     DoCmd.SetWarnings True
  11.     Me.Requery
  12. End Sub
Please help me..
Thanks.
Dec 21 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6161
by: Julia Briggs | last post by:
Hello, I've read quite a bit of discussion on different approaches of how to create a download progress meter that can be implemented into a Web site. I understand that by the very nature of the way the download transport is handled that this cannot "automatically" be done... upload progress meters exist, but not download. However, I've seen different theories on how it could be done if one knows the file size. Is anyone aware of a...
3
2661
by: Brian Birtle | last post by:
**** A CHALLENGE TO THE GURUS - refute the statement "It's impossible to build a file upload progress meter using ASP.NET" **** First person to prove me wrong gets "All Time .NET Programming GOD" listing in my address book and (optionally) their name listed on my "news" page of my birtle.com website (listed as "Jane Smith is a Programming GOD") for at least a month. Why not take a moment to read more and possibly boost your ego to all time...
1
1603
by: Doug | last post by:
In I.E. 6 (and probably other versions as well), there is a sort of progress meter in the panel at the bottom of the window. This meter increments a few pixels at a time when the browser is trying to connect or do some other operation that is taking more than a few seconds. My suspicion is that there is no way that this "progress meter" can actually be metering anything meaningful (at least with respect to whatever is being downloaded or...
8
5189
by: Brian Henry | last post by:
I created a smooth progress bar with this code.. but if you update the values in a row quickly of it and watch it on screen it flickers... how would i change this to reduce the flickering? thanks... Imports System Imports System.Drawing Imports System.Drawing.Drawing2D
4
2918
by: bfulford | last post by:
I have a macro that needs to have a progress meter displayed since it is long running. I moved the Macro's instructions to a table and pulled those records into a recordset that is looped through. PROBLEM -- The form, with a progress meter and labels to inform the user as to which step of a series of instructions is being done and the overall progress, seems to lock from repainting after the first docmd.openquery because the form is never...
0
1261
by: Eric Pradel | last post by:
Hi, This is my first post, and I'm a real newcomer to scripting. I have a script that is doing exactly what I want it to do, which is to open a new window with set specifications. However, in the opened window, the progress meter in the status bar "sticks" at about halfway and the hourglass icon appears even though the page has otherwise finished loading (its contents are a few paragraphs of text only.) It's as if the window is expecting...
2
3699
by: Adam R | last post by:
Looking for an upload progress meter which can works with 'non-patched' PHP4. -- -------------------------------------- Adam Raszkiewicz Brothers-in-arts.com --------------------------------------
5
23650
by: maniesh | last post by:
I want to complete a project and I want to place a timed progress bar on my splash screen, I want to find out a method of timing my progress bar to update every 10 seconds. here's what I got so far: Private Sub Form_Open(Cancel As Integer) If (ProgressBar0.Value <0) then ProgressBar0.Value = ProgressBar0.Value +10 End If ProgressBar0.Value =100 End Sub
0
8268
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8641
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.