Stuart McLachlan
stuart at lexacorp.com.pg
Thu Mar 20 17:55:00 CST 2003
On 19 Mar 2003 at 10:53, Darren Dick wrote:
> Hi Stuart
> The following code just won't work, even with your 'time' suggestion <sigh>
> I must be missing something really obvious. This should work.
>
A couple of things I messed up in my original example. That's what happens when you write code directly in an email
client and don't debug :-(
(rs!BookingTime - cmbInterval / dblMinutes) >= Time()
Should be:
Time => (rs!BookingTime - cmbInterval * dblMinutes)
In my first example, we need to mulitpy by the fractional dblMinutes, not divide by it (that's why you would have been
getting dates in then 1860s or whatever.
We need it to trigger after the notice time, not before it!
This one has been tired in A2K and worked as expected:
Private Sub Form_Timer()
Dim rs As DAO.Recordset
Dim dblMinutes As Double
dblMinutes = 1 / 24 / 60
If IsNull(cmbInterval) Then Exit Sub
Set rs = Me.Recordset
While Not rs.EOF
If Time() >= (rs!BookingTime - cmbInterval * dblMinutes) And Not rs!WarningDone Then
MsgBox rs!Message
rs.Edit
rs!WarningDone = True
rs.Update
End If
rs.MoveNext
Wend
End Sub
--
Stuart McLachlan
Lexacorp Ltd
Application Development, IT Consultancy
http://www.lexacorp.com.pg