Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code is Running too Fast

Status
Not open for further replies.

NewfieGolfer

Technical User
Mar 29, 2001
80
CA


My code runs too quick. I need to slow down the process. I have a percent count box that increases in value as records are viewed automatically. Along with the count there is a percent complete bar that suppose to increase as the percent count increases. If I step through the code it will display the bar.

The way I set up the completion bar was to have 20 rectangles that are invisible until a certain value occurs in the percent count control. But, the code runs so fast that there is not opportunity to see the bar increase, or become visible (at least that's what I think). You can see the percent counter increasing though. The code runs so fast that even the form which contains the percent bar and counter doesn't fully load.

Can someone help,

Thanks

NG
 
This is a first. I have never heard someone want to slow the process down.

Actually, how are you displaying this bar? Is it a control on the form, a subform, etc? I get the feeling that your bar is working, but it is either not refreshing fast enough or that it is a separate object and is "moving to the back" behind your form during the process. If this is the case, it might appear to flicker as it jumps to the front and then goes away. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Are you trying to slow down the process just for the sake of displaying a status bar??

I have some code that I haven't really tested that is supposed to pause the code execution for a specified amount of time:

Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)

Sub sSleep(lngMilliSec As Long)
If lngMilliSec > 0 Then
Call sapiSleep(lngMilliSec)
End If
End Sub

To pause the code, call the sub sSleep(number of milliseconds), i.e. sSleep(5000) would pause the code for 5 seconds.

Also, look into the Me.Repaint function to update your display. Mike Rohde
rohdem@marshallengines.com
 


Thanks,

I was using the refresh function rather than the repaint function. Everything is works fine now with the repaint and I didn't need to slow the code. What was I thinking, slow the code.!?!


NG
(chris)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top