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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress Bar Again! Yes I looked...

Status
Not open for further replies.

MkIIISupra

Programmer
Apr 17, 2002
108
US
But the samples I found are for looping through record sets. I have a timer event set for 5 minutes. Every 5 minutes the form is closed then re-opened. Right now it seems to be the only method I have to refresh the data within it. And it works for now, I will make it right in later versions. Anyhow I am in a quandry in that I have the progress bar on the form but I can figure out how to get it to show progress during the 5 minutes period. I was even considering a counter on the form, sort of a count down clock but I haven't been able to figure that out either.

Either method would be nice! Here is the code that I have so far:

Private Sub Form_Load()

Me.TimerInterval = 60000 ' 5 Minute Iteration

myBool = True

DoCmd.GoToRecord, , acFirst

Do
stDistNum = Me.distNum
stDistName = Me.distName
stIssueTime = Me.issueTime
stIssueDate = Me.issueDate
stStatus = Me.ProcessStatus
stHoldReas = Me.holdReason
stSoNum = Me.soNum
stTmpLst = stDistNum & ";" & stDistName & ";" & stIssueTime & ";" & stIssueDate & ";" _
& stStatus & ";" & stHoldReas & ";" & stSoNum & ";" & stTmpLst

If (Me.processStatus) = "On Hold" Then
intHold = intHold + 1
ElseIf (Me.processStatus+ = "Released" Then
intRelease = intRelease + 1
End If

DoCmd.GoToRecord, , AcNext
intRecCnt = intRecCnt + 1

If IsNull(Me.distNum) Then
myBool = False
End If

Loop Until myBool = False

'Other code here

End Sub

------------------------------------------------------------

Private Sub Form_Timer

DoCmd.Close acForm Me.NAME
DoCmd.OpenForm "frmWKCE_LoginErrorsActive"

End Sub

I want either the progress bar to work during the 5 minute period or a counter to display on the form showing time till next refresh. Thanks!!!

One by one the penguins steal my sanity!
 
Hi

Interesting challenge.

To get something to happen in the period where the timer runs... think you'll have to use the timer event.

So, in the following snippet, I've drastically redused the timerintervall (using 5 seconds), then in the timer event, check for different things, uppdating information on the form (using two textboxes, txtStart and txtElapsed) and the inbuilt progress bar. And I've totally disregarded you code;-) One of the things, this will continue in 5 min cycluses.

So, using some form level variables, which are set at load.

Then the timer snippet, that will update the form controlls and display the progress bar.

There are elements of hardcoding here, timer intervall, maxcount in the progress bar, but it might be something to work with.

It would be nice to hear whether this approach might suit your needs.

[tt]Private mdtTmpTime As Date
Private mdtTime As Date
Private mvarReturn As Variant
Const mcsMsg = "Processing..."

Private Sub Form_Open(Cancel As Integer)
' Initialising variables, form controls and progress bar
mdtTime = Time
mdtTmpTime = mdtTime
Me!txtStart = mdtTime
Me!txtElapsed = 0
Me.TimerInterval = 5000 ' 5 seconds intervals
mvarReturn = SysCmd(acSysCmdClearStatus)
mvarReturn = SysCmd(acSysCmdInitMeter, mcsMsg, 300)
End Sub


Private Sub Form_Timer()
Const clSekBetUpdate = 15
Const clMinBetOpen = 5
If DateDiff("s", mdtTmpTime, Time) >= clSekBetUpdate Then
' Updating variables, form controls and progress bar
mdtTmpTime = Time
Me!txtElapsed = DateAdd("s", DateDiff("s", mdtTime, mdtTmpTime), 0)
mvarReturn = SysCmd(acSysCmdUpdateMeter, (mdtTmpTime - mdtTime) * 100000)
If DateDiff("n", mdtTime, Time) >= clMinBetOpen Then
' Resetting variables and form controls before next turn
mdtTime = Time
mdtTmpTime = mdtTime
Me!txtStart = mdtTime
Me!txtElapsed = 0
' Clearing and resetting the progress bar
mvarReturn = SysCmd(acSysCmdClearStatus)
mvarReturn = SysCmd(acSysCmdInitMeter, mcsMsg, 300)
DoCmd.OpenForm "someform"
Me.SetFocus
End If
End If
End Sub[/tt]

HTH Roy-Vidar
 
What is the "in built progress bar" you refer to?

Be ALERT - Your country needs Lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top