D
DJN
Guest
I have the following procedure that reads DisplayTime
and CompactTime from a dbtable. If now() is between DisplayTime and
CompactTime it should change the caption of the open forms to read the time
but it never gets to display the caption as the formula never works out.
What have I done wrong ??
Private Sub Form_Timer()
Dim i As Integer
If Format(Now(), "hh:mm:ss") > DisplayTime And Format(Now(), "hh:mm:ss")< CompactTime Then
For i = 0 To Forms.Count - 1
Forms(i).Caption = "Current time = " & Format(Now, "hh:mm:ss") & " Database close time = " & CloseTime
Next i
End If
End Sub
The problem seems to be associated with the if Format line. The two statements on their own seem to work but when the AND is added it fails.
Any help would be appreciated.
and CompactTime from a dbtable. If now() is between DisplayTime and
CompactTime it should change the caption of the open forms to read the time
but it never gets to display the caption as the formula never works out.
What have I done wrong ??
Private Sub Form_Timer()
Dim i As Integer
If Format(Now(), "hh:mm:ss") > DisplayTime And Format(Now(), "hh:mm:ss")< CompactTime Then
For i = 0 To Forms.Count - 1
Forms(i).Caption = "Current time = " & Format(Now, "hh:mm:ss") & " Database close time = " & CloseTime
Next i
End If
End Sub
The problem seems to be associated with the if Format line. The two statements on their own seem to work but when the AND is added it fails.
Any help would be appreciated.