Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    Bend, Oregon
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using MsgBox Function to Display Progress (Access 2003 SP2)

    We have an Access database that uses a macro to call a series of vba procedures to import several text files, processes their data through a number of tables and queries, then export to a couple of text files that are uploaded to a state agency. I needed to add some means of displaying the progress through this rather long-running process, so I included some MsgBox functions in several of the vba procedures to display which procedure was running at any given time. The problem is, that this is supposed to be able to run unattended, and the message boxes are holding up the process waiting for a response. So far, my attempts to manipulate the msgbox arguments have not improved things much. Is there a better way to do this? Or, can someone point me to an example of using the msgbox function to open a message during the performance of a procedure and close it when the procedure ends, without human intervention?

    Thanks in advance for your help,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using MsgBox Function to Display Progress (Access 2003 SP2)

    A MsgBox is always modal, i.e. code execution pauses until the user clicks one of the buttons or presses the corresponding keyboard shortcut. So you can't use a MsgBox to show progress.

    Alternatives are:

    - Display text in the status bar, for example:

    SysCmd acSysCmdSetStatus, "Exporting file # 3"

    (Use SysCmd acSysCmdClearStatus to remove the status bar text when you're done).

    - Create a popup form and set the text of a label on the form:

    DoCmd.OpenForm "frmMessage"
    Forms!frmMessage!lblInfo.Caption = "Exporting file # 3"
    Forms!frmMessage.Repaint

    (Use DoCmd.Close acForm, "frmMessage" to close the form when you're done)

  3. #3
    Star Lounger
    Join Date
    Feb 2003
    Location
    Bend, Oregon
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using MsgBox Function to Display Progress (Access 2003 SP2)

    Hans,

    Thank you. The popup form works perfectly for what I needed to show.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •