Sleep / Pause - Refreshing a form periodically

S

Stephen

Hello

Whats the best way of refreshing a form periodically? I have an access
form that displays data that will need to update automatically every
minute.

I have tried the sleep function:

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

and also the timer with do events.

the first one locks up access and the second one hogs the CPU, is there
a function/code in between the two that would be useful? Using access
97

Thanks for any ideas.
 
G

Guest

Steven,

What value are using for the timer interval? For a refresh every minute,
you need to set it to 60,000.

I'm not sure what your form does, but if it is a data input form, requerying
the data every minute is a bad idea. But you could put some code in the
timer event to determine whether the form is dirty or you are on a new
record. In those instances, I would not want to requery the form, so your
code might look like:

Private Sub Timer()

If Me.Dirty Or Me.NewRecord Then
'do nothing
Else
Me.Requery
End If

End Sub

HTH
Dale
 

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