glitch -- I am not seeing something

J

JR

The following code works -- too well! If, as in the case
below, I set the counter at "4" the sub runs the code

BU
DE
EX
OF

4 times! (continued after code)

<><><><><><><><><><><>BEGIN CODE<><><><><><><><><>
Private Sub Command37_Click()

If MsgBox("This'll take a while." & vbCrLf & vbCrLf & "The
table will open when finished.", vbOKCancel) <> vbCancel
Then

Dim Counter As Integer

SysCmd acSysCmdInitMeter, "Appending: ", 4
For Counter = 1 To 4
SysCmd acSysCmdUpdateMeter, Counter

DoCmd.Hourglass True


BU
DE
Ex
Of

DoCmd.Hourglass False

Next Counter
SysCmd acSysCmdRemoveMeter


DoCmd.OpenTable "Results_Normalized"
End If
<><><><><><><><><><><>END CODE<><><><><><><><><>
What I am trying to do is to have a progress bar show up
to show the progress of the appends that are running under
BU
DE
Ex
Of

Can anyone show me why the code is running x times?

Can the progress bar be made to show the relative time
required to run the queries?
 
R

Roger Carlson

Well of course it's running it 4 times. You have all 4 calls in each
iteration of the loop. I guess I'd just do something like this:

SysCmd acSysCmdInitMeter, "Appending: ", 4
DoCmd.Hourglass True
BU
SysCmd acSysCmdUpdateMeter, 1
DE
SysCmd acSysCmdUpdateMeter, 2
EX
SysCmd acSysCmdUpdateMeter, 3
OF
SysCmd acSysCmdUpdateMeter, 4
DoCmd.Hourglass False
SysCmd acSysCmdRemoveMeter

No real reason to have a loop. BTW, you might want to look into the
Microsoft Progress Bar Control that comes with Access. It's an ActiveX
control that you can put right on a form.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top