I have been asked to maintain an ACCESS app and I’m learning as I go – BUT being new to VBA I understand that with error and subsequent debug = ‘invalid use of Null (error 94)’ that a null is involved in an equation which always will gives null as return value
line ‘OldDate = ….’ in code following —
Public Function DateChanged(NewDate As Date) As Boolean
Dim OldDate As Date
Dim AvailableUSOnCall As String
DateChanged = False
Set dbs = CurrentDb
’11/18/02/df AvailableUSOnCall = “SELECT tblEmployees.EmployeeID, tblEmployees.EmployeeName, tblEmployees.Available, tblEmployees.Canadian, tblEmployees.OnCallStartDate ” _
& “FROM tblEmployees WHERE (((tblEmployees.Available)=Yes) AND ((tblEmployees.OnCall)=Yes) and ((tblEmployees.Canadian)=No));”
AvailableUSOnCall = “SELECT tblEmployees.EmployeeID, tblEmployees.EmployeeName, tblEmployees.Available, tblEmployees.GC, tblEmployees.OnCallStartDate ” _
& “FROM tblEmployees WHERE (((tblEmployees.Available)=Yes) AND ((tblEmployees.OnCall)=Yes) AND ((tblEmployees.GC)=yes));”
Set rstOnCall = dbs.OpenRecordset(AvailableUSOnCall, dbOpenDynaset)
OldDate = rstOnCall!OnCallStartDate
IfNewDate <> OldDate Then
DateChanged = True
End If
End Function
— pre thanks – dfoubert