473,790 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Progress display doesn't work

1,277 Recognized Expert Top Contributor
Okay, I bet this is something simple ... I'm running through a pair of loops and I want to show my progress as I go. The outer loop advances through the customer table, the inner loop advances through product classes. Each time I advance to a new customer, I set me!lblCustomer. Caption to be the customer ID, and each time I advance a product class I set me!lblClass.Cap tion to equal the product class. The trouble is, nothing shows in these captions until the very end, after I have displayed my "Done" message. However, if I use the debugger and stop in the loops, the captions display as they should.

I'd appreciate any comments or suggestions.
Jim

Here's my code. It doesn't matter whether grpActionType = 1, 2, or 3, it behaves the same way.
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.Hourglass False
  2.     Me!lblCustomer.Visible = True
  3.     Me!lblClass.Visible = True
  4.  
  5.     rstCustomers.MoveFirst
  6.     Do While Not rstCustomers.EOF
  7.         Me!lblCustomer.Caption = rstCustomers!strCustomerID
  8.         If Me!grpActionType = 1 Then ' deleting
  9.             rstProductClass.MoveFirst
  10.             Do While Not rstProductClass.EOF
  11.                 strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ and strItemClass =""" & rstProductClass!strStringItem & """"
  12.                 Me!lblClass.Caption = rstProductClass!strStringItem
  13.                 Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
  14.                ' Me.Refresh
  15.  
  16.                 rstSpecialPricing.FindFirst (strCriteria)
  17.                 If Not rstSpecialPricing.NoMatch Then
  18.                     rstSpecialPricing.Edit
  19.                         rstSpecialPricing("ynRestricted") = False
  20.                     rstSpecialPricing.Update
  21.                 End If
  22.              rstProductClass.MoveNext
  23.              Loop
  24.  
  25.         ElseIf Me!grpActionType = 2 Then 'copy
  26.  
  27.             rstProductClass.MoveFirst
  28.             Do While Not rstProductClass.EOF
  29. '                strCriteria = "strCustomerID = """ & Me!cboFromAccount & """ AND strItemClass =""" & rstProductClass!strStringItem & """"
  30.                 strCriteria = "strCustomerID = """ & Me!cboFromAccount & """"
  31.                 Me!lblClass.Caption = rstProductClass!strStringItem
  32.                 Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
  33.                 'Me.Refresh
  34.                 rstSpecialPricing.FindFirst (strCriteria)
  35.  
  36.                 If Not rstSpecialPricing.NoMatch Then
  37.                     Dim ysnRestricted As Boolean
  38.                     ysnRestricted = rstSpecialPricing!ynRestricted
  39.  
  40.                     strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ AND strItemClass =""" & rstProductClass!strStringItem & """"
  41.                     rstSpecialPricing.FindFirst (strCriteria)
  42.                     If Not rstSpecialPricing.NoMatch Then
  43.                         rstSpecialPricing.Edit
  44.                             rstSpecialPricing("ynRestricted") = ysnRestricted
  45.                         rstSpecialPricing.Update
  46.                     Else
  47.                         rstSpecialPricing.AddNew
  48.                             rstSpecialPricing("strCustomerID") = rstCustomers!strCustomerID
  49.                             rstSpecialPricing("strItemClass") = rstProductClass!strStringItem
  50.                             rstSpecialPricing("dtmBeginDate") = #1/1/2000#
  51.                             rstSpecialPricing("dtmEndDate") = #12/31/2099#
  52.                             rstSpecialPricing("ynRestricted") = ysnRestricted
  53.                         rstSpecialPricing.Update
  54.                     End If
  55.                 End If
  56.              rstProductClass.MoveNext
  57.              Loop
  58.  
  59.         ElseIf Me!grpActionType = 3 Then  ' new restrictions
  60.             rstProductClass.MoveFirst
  61.             Do While Not rstProductClass.EOF
  62.                 strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ & strItemClass =""" & rstProductClass!strStringItem & """"
  63.                 Me!lblClass.Caption = rstProductClass!strStringItem
  64.                 Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
  65.                 'Me.Refresh
  66.                 rstSpecialPricing.FindFirst (strCriteria)
  67.                 If Not rstSpecialPricing.NoMatch Then
  68.                     rstSpecialPricing.Edit
  69.                         rstSpecialPricing("ynRestricted") = True
  70.                     rstSpecialPricing.Update
  71.                 Else
  72.                         rstSpecialPricing.AddNew
  73.                             rstSpecialPricing("strCustomerID") = rstCustomers!strCustomerID
  74.                             rstSpecialPricing("strItemClass") = rstProductClass!strStringItem
  75.                             rstSpecialPricing("dtmBeginDate") = #1/1/2000#
  76.                             rstSpecialPricing("dtmEndDate") = #12/31/2099#
  77.                             rstSpecialPricing("ynRestricted") = True
  78.                         rstSpecialPricing.Update
  79.                 End If
  80.              rstProductClass.MoveNext
  81.              Loop
  82.         End If
  83.     rstCustomers.MoveNext
  84.     Loop
  85.  
  86.     rstCustomers.Close
  87.     rstSpecialPricing.Close
  88.     rstProductClass.Close
  89.     Set rstCustomers = Nothing
  90.     Set rstSpecialPricing = Nothing
  91.     Set rstproductionclass = Nothing
  92.     Set dbs = Nothing
  93.  
  94.     vbresult = MsgBox("Done", vbOKOnly)
  95.  
  96.     DoCmd.Hourglass False
  97.     Me!lblCustomer.Visible = False
  98.     Me!lblClass.Visible = False
  99.  
  100.  
  101.  
Mar 17 '08 #1
6 2218
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. Access takes a relatively lazy approach to screen refresh, so when you change your caption within the loop you should use me.repaint to force a screen refresh (not me.refresh - commented out in line 14, 33 etc).

There are 98 lines listed in your code, of which only a small number are really relevant to your problem. It would certainly help us to read your post more easily if you could simply excerpt the relevant lines instead of posting it all, interesting though it is!

-Stewart
Mar 17 '08 #2
Scott Price
1,384 Recognized Expert Top Contributor
Try using Me.Repaint instead of the Me.Refresh (that you have commented out). Here is the MS Help file on Repaint:

Repaint Method
See AlsoApplies ToExampleSpecif icsThe Repaint method completes any pending screen updates for a specified form. When performed on a form, the Repaint method also completes any pending recalculations of the form's controls.

expression.Repa int
expression Required. An expression that returns one of the objects in the Applies To list.

Remarks
Microsoft Access sometimes waits to complete pending screen updates until it finishes other tasks. With the Repaint method, you can force immediate repainting of the controls on the specified form. You can use the Repaint method:

When you change values in a number of fields. Unless you force a repaint, Microsoft Access might not display the changes immediately, especially if other fields, such as those in an expression in a calculated control, depend on values in the changed fields.


When you want to make sure that a form displays data in all of its fields. For example, fields containing OLE objects often don't display their data immediately after you open a form.
This method doesn't cause a requery of the database, nor does it show new or changed records in the form's underlying record source. You can use the Requery method to requery the source of data for the form or one of its controls.

Notes

Don't confuse the Repaint method with the Refresh method, or with the Refresh command on the Records menu. The Refresh method and Refresh command show changes you or other users have made to the underlying record source for any of the currently displayed records in forms and datasheets. The Repaint method simply updates the screen when repainting has been delayed while Microsoft Access completes other tasks.


The Repaint method differs from the Echo method in that the Repaint method forces a single immediate repaint, while the Echo method turns repainting on or off.
Example
The following example uses the Repaint method to repaint a form when the form receives the focus:

Private Sub Form_Activate()
Me.Repaint
End Sub

Regards,
Scott
Mar 17 '08 #3
Scott Price
1,384 Recognized Expert Top Contributor
Beat me to it, Stewart! Good on you :-)

Regards,
Scott
Mar 17 '08 #4
missinglinq
3,532 Recognized Expert Specialist
And , of course, it may simply be that the loop is executing too quickly for the human eye to register the changes in the label caption!

Linq ;0)>
Mar 17 '08 #5
jimatqsi
1,277 Recognized Expert Top Contributor
Thanks very much to all who replied, me.repaint did the trick. :)
Mar 17 '08 #6
Scott Price
1,384 Recognized Expert Top Contributor
You're quite welcome! Glad to be able to help.

Regards,
Scott
Mar 17 '08 #7

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

Similar topics

5
7385
by: Søren Reinke | last post by:
Hi there I am working on a program where the user should be able to import some CSV files. With my set of test data, it takes about 2 minutes to import, while it is importing the program sort of freezes. Therefore i would like to open a little window with a progress bar in it that shows how far the import has come.
4
5734
by: Kenneth Keeley | last post by:
Hi, I have a page that uploads files to my server and I wish to display a "Please wait while uploading" page to the user while the file is uploading. I have been able to redirect the user once the file is finished uploading but am not sure how to do it while file is uploading. Some sample code would be welcomed with open arms. Thank You.
11
2159
by: simon | last post by:
when I execute aspx page, it works about 5 minutes - I calculate some statistics. Is there some way, that I can show user time bar or smething similar? That he nows, that page is working. Thank you, Simon
2
1574
by: Raed Sawalha | last post by:
Dear: I need to make some progress action when doing long running task to inform user that something is happening, so I did the following: 1. download a gif file that do some download animation. 2. in my aspx page add DIV and put the image inside it and make it runat server with initial display as none. 3. in page load for send button i did btnSend.Attributes = "return SwapButton()"
7
5391
by: Pepi Tonas | last post by:
I have a form that takes some time to load because it has to populate some Data. I was trying to display a form on top of it with an activity bar so that user can see that something's going on. I have tried doing this and using a progress bar that counts up to 100 and then zeros down so that it should be constantly moving while the main or background windows finishes loading. The problem is that the "in progress window" doesn't display...
9
3270
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my problem occurs when i try to show a progress bar. The screen freezes. I know i'm not the first one to ask about it. but i'm looking
15
3549
by: eladla | last post by:
Hi! I am creating a composite control the does some of it`s own data access. I want to display a progress bar between the time the page is loaded and the control place holder is displayed and final display of the data from the database. I was thinking of manually opening a second thread in the Render method, but nothing is displayed before the render method exits anyway. Anyone know of a good way to do this? I have been working on this...
2
3884
by: Simon | last post by:
Hello, I would like to know if there is a way to display a progressbar while loading a page. (We developped our application in Caché (intersystems), some functions need some time to calculate&display data, in the mean time I don't want users to stare at an internet explorer in whitch nothing happens, i want them to see that something is happening and even better, the status of loading.)
0
9666
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
9512
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
10200
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...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5422
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
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
2
3707
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.