Hi All,
I have a function when the value is Null its stopped which is great but when the value in the field(date) value. it working great.
The field which is checking its date value. But some time if the date value is old date meaning not equal to today's date(Now) it shouldn't be run but some how it run , I have use the following condtion please help
I have control by using A <> B when the old date exist in the field but when the rs is NUll its generate error.
I hope it does make sense.
Many thanks
Farhan
I have a function when the value is Null its stopped which is great but when the value in the field(date) value. it working great.
The field which is checking its date value. But some time if the date value is old date meaning not equal to today's date(Now) it shouldn't be run but some how it run , I have use the following condtion please help
Code:
Private Function TestInfoCom() As ReturnStatus
Dim rs As DAO.Recordset
'Dim dtMEnd_dtime As Date
Dim A As DAte
Dim B As String
On Error GoTo Err_Handler
'Check INFoCOM for the daily reports
Set rs = CurrentDb.OpenRecordset("qryTest_InfoCom_Completion", dbOpenDynaset)
'rs.MoveFirst
'A = Weekday(rs.Fields("maxofend_dtime").Value) ' Add on 22-Aug-2011
'B = Weekday(Now()) ' Add on 22-Aug-2011
If rs.RecordCount = 0 OR A <> B Then ' add "OR" condition because Automation start even the old date/value exist in field qryTest_InfoCom_Completion.maxofend_dtime
MsgBox "InfoCom not Completed"
'And Weekday(rs.Fields("maxofend_dtime").Value) <> Weekday(Now()) Then
'And Format(rs.Fields("maxofend_dtime").Value, "DD/MM/YYYY") <> Format(Now(), "DD/MM/YYYY") Then
'Or Weekday(rs.Fields("maxofend_dtime").Value) <> Weekday(Now()) Then 'Add the condition if the Day of the week not same as today's day its return nothing
'03/12/09 add the new check if date is not equal to today's date
'Not completed yet
rs.Close
Set rs = Nothing
TestInfoCom = NothingToDo
Exit Function
End If
I have control by using A <> B when the old date exist in the field but when the rs is NUll its generate error.
I hope it does make sense.
Many thanks
Farhan