M
MTTrader
This Timer Event code is in a form called TourChart3. TourChart3 opens a
form called MatchDetail. Match detail updates two different tables.
If I open MatchDetail and just close it. TourChart3 keeps its unique field
values (Me.TourID, Me.SectionID) used to open a record set in the below timer
code.
However, When I open MatchDetail and update the tables Me.TourID and
Me.SectionID in TourChart3 form turn to Null values and the Timer code fails
with a SQL syntax error.
I was able to open TourChart3 Infinit times with out the form failing before
I added the Timer Event code. If at any time Me.TourID and SectionID went
Null. Opening MatchDetail would have failed.
I have not been able to capture where it loses Me.TourID and SectionID
values.
HELP any suggestions would be welcome.
============== Timer Event Code ====================
Set rstTemp1 = dbs.OpenRecordset( _
"SELECT TourID, SectionID, MatchNum,
MatchStatus, " _
& " TimeStarted, TimeEnded,
ElaspedTime " _
& " FROM TourMatch" _
& " WHERE TourID = " & Me.TourID _
& " AND SectionID = " & Me.SectionID _
& " AND MatchStatus Like " & "'" & "In
Progress" & "'", _
dbOpenDynaset)
On Error GoTo ErrorHandler:
With dbs
With rstTemp1
If rstTemp1.EOF = True Then
Else
.MoveFirst
Do While Not rstTemp1.EOF
Do While CurrentProject.AllForms("MatchDetail").IsLoaded
DoEvents ' Yield to other processes.
Loop
.Edit
!TimeEnded = Now()
.Update
.Edit
'!ElaspedTime = DateDiff("n", !TimeEnded, !TimeStarted)
!ElaspedTime = DateDiff("n", rstTemp1!TimeStarted,
rstTemp1!TimeEnded)
.Update
.MoveNext
Loop
End If
End With
End With
'Me.TourID = TID
'Me.SectionID = SectionID
'Me.Repaint
Me.SetFocus
Exit Sub
form called MatchDetail. Match detail updates two different tables.
If I open MatchDetail and just close it. TourChart3 keeps its unique field
values (Me.TourID, Me.SectionID) used to open a record set in the below timer
code.
However, When I open MatchDetail and update the tables Me.TourID and
Me.SectionID in TourChart3 form turn to Null values and the Timer code fails
with a SQL syntax error.
I was able to open TourChart3 Infinit times with out the form failing before
I added the Timer Event code. If at any time Me.TourID and SectionID went
Null. Opening MatchDetail would have failed.
I have not been able to capture where it loses Me.TourID and SectionID
values.
HELP any suggestions would be welcome.
============== Timer Event Code ====================
Set rstTemp1 = dbs.OpenRecordset( _
"SELECT TourID, SectionID, MatchNum,
MatchStatus, " _
& " TimeStarted, TimeEnded,
ElaspedTime " _
& " FROM TourMatch" _
& " WHERE TourID = " & Me.TourID _
& " AND SectionID = " & Me.SectionID _
& " AND MatchStatus Like " & "'" & "In
Progress" & "'", _
dbOpenDynaset)
On Error GoTo ErrorHandler:
With dbs
With rstTemp1
If rstTemp1.EOF = True Then
Else
.MoveFirst
Do While Not rstTemp1.EOF
Do While CurrentProject.AllForms("MatchDetail").IsLoaded
DoEvents ' Yield to other processes.
Loop
.Edit
!TimeEnded = Now()
.Update
.Edit
'!ElaspedTime = DateDiff("n", !TimeEnded, !TimeStarted)
!ElaspedTime = DateDiff("n", rstTemp1!TimeStarted,
rstTemp1!TimeEnded)
.Update
.MoveNext
Loop
End If
End With
End With
'Me.TourID = TID
'Me.SectionID = SectionID
'Me.Repaint
Me.SetFocus
Exit Sub