I think you're saying that you're having trouble with the
code in the ScreenUpdate procedure, but you didn't post that
code. It's probably as simple as something like
Forms("form1").sometextbox = Start
If so, I would have expected the Repaint to take care of it,
but sometimes it isn't enough. Try adding one or more
DoEvents:
Forms("form1").Repaint
DoEvents
--
Marsh
MVP [MS Access]
Sorry for the length, but I'm trying to help you help me.
Option Compare Database
Option Explicit
Dim x, StopError
Dim IntervalTime As Single
Public RunTime As Single
Public Start As Single
Public EndTime As Single
Public clrGRN
Public clrYEL
Public clrRED
Dim MSComm As Object ' Serial port as inputs monitoring lap counts
Public Function GetStartTimer() As Single
GetStartTimer = Start
End Function
Public Function GetRunTime() As Single
GetRunTime = RunTime
End Function
'This function is here because I couldn't get
'the functions GetStartTimer() and GetRunTime()
'to display their values without it(????)
Public Function ScreenUpdate()
Forms("form1").Refresh
End Function
Public Sub StartRace()
' all rectangles start out yellow
clrGRN = 65280
clrYEL = 65535
clrRED = 255
' Each rectangle will turn Green in sequence
' in the interval time specified
IntervalTime = 1 ' Seconds
For x = 1 To 5
' Timer = number of seconds since last midnight (microSeconds)
Start = Timer
'The rectangles and text boxes are on "Form1".
'For now I would like to be able to display the "Start" variable
'on "Form1" as each rectangle turns green. If I can do that I can
easily
'Display the lap times
EndTime = Start + IntervalTime
Do While Timer < EndTime
Loop
If x = 1 Then Forms("Form1").Box7.BackColor = clrGRN
If x = 2 Then Forms("Form1").Box13.BackColor = clrGRN
If x = 3 Then Forms("Form1").Box14.BackColor = clrGRN
If x = 4 Then Forms("Form1").Box17.BackColor = clrGRN
If x = 5 Then Forms("Form1").Box18.BackColor = clrGRN
'Try to get variables to update on "Form1"
Call ScreenUpdate
'This repaint worked wonders on the rectangle colour changes
Forms("form1").Repaint
Next x
End Sub