Delayed Visible on VBA code


I am writing a VBA event procedure in MS 2007 Access for when you click a button. My code is quite lengthy and I want some labels I created to become visible as the code finishes certain sections so the user will know it is running correctly. When the form opens these labels are invisible (.visible=False), and throughout the code, at specific points, I've inserted lines that turn each of these labels visible (.visible=True).

The code works because they all turn visible, but they ALL turn visible at the same time at the END of the VBA procedure! This defeats the purpose of letting the user know that the code is running!

I'm sure there is a line of code that can make these labels visible in real time- and not wait until the end of the procedure. If anyone can help I would GREATLY appreciate it!!

Thanks so much!!


  • have you try to reconfigure the object properties?
    inserting codes and configuring the properties are quite different.

    visible=true ; the text will be displayed
    visible=false; the text will not be displayed

    try to configure the properties,
    maybe there you will find what you are looking for.
  • windows programs run a bit different than you may think. when your program starts a thread of execution, the code runs however the screen gui updates do not occur in 'realtime'. this is done to optimize performance. this is true in visual basic and access. in VB there is a method called "Refresh" and in Access its named "Repaint", those methods tell windows to update the window object (form) that is being displayed.

    vb6 on-line help-
    "Generally, painting a form or control is handled automatically while no events are occurring. However, there may be situations where you want the form or control updated immediately. For example, if you use a file list box, a directory list box, or a drive list box to show the current status of the directory structure, you can use Refresh to update the list whenever a change is made to the directory structure."

    access 2002 help-
    "The 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.


    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."

    therefore, you may be able to write your code to force windows to update the form-

    me.textbox = "some text"
    me.textbox.visible = true
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!