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

Action Query stops Form from refreshing

Status
Not open for further replies.

jancheta

Programmer
Aug 30, 2002
51
US
I am trying display the elapsed time when an action query is being ran. The problem I'm encountering is that when the query runs, the form is not updated. I placed Me.Repaint and Doevents but the text box will still not update.

----
FORM1
-----
'I have a text box called ElapsedTime and a button called cmdRun
'
Option Compare Database
Option Explicit
Dim TotalElapsedMilliSec As Long
Dim StartTickCount As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub cmdRun_Click()
Dim mydb As Database, qdf As QueryDef
StartTickCount = GetTickCount()
Me.TimerInterval = 15
Set mydb = CurrentDb
Set qdf = mydb.CreateQueryDef("", "sql - action query")
qdf.Execute dbFailOnError
Me.TimerInterval = 0
End Sub

Sub Form_Timer()
Dim Hours As String, Minutes As String, Seconds As String
Dim MilliSec As String, Msg As String, ElapsedMilliSec As Long
ElapsedMilliSec = (GetTickCount() - StartTickCount) + _
TotalElapsedMilliSec
Hours = Format((ElapsedMilliSec \ 3600000), "00")
Minutes = Format((ElapsedMilliSec \ 60000) Mod 60, "00")
Seconds = Format((ElapsedMilliSec \ 1000) Mod 60, "00")
MilliSec = Format((ElapsedMilliSec Mod 1000) \ 10, "00")
Me!ElapsedTime = Hours & ":" & Minutes & ":" & Seconds & ":" _
& MilliSec
End Sub

Then I created another Form that opens when the cmdRun is clicked with the same fashion as above thinking that this form might be refreshed, but it didn't as well.

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top