Public Function UpdateParent()
'-- Update the Parent Form OracleCleardate
'-- ... IF all local ItemOracleClearDate fields have a valid date
On Error GoTo ErrUpdateParent
Dim AllCleared As Boolean
[COLOR="Red"]Dim MyDate As Date[/COLOR]
AllCleared = True '-- Initialize the flag
'-- Examine all of the records
With Me.RecordsetClone
If .RecordCount Then '-- Only if records exist
.MoveFirst '-- Resets record pointer position
Do While Not .EOF
If Not IsDate(.ItemOracleClearDate) Then
'-- Reset the flag
AllCleared = False
[COLOR="Red"]Else
If .ItemOracleClearDate > MyDate Then
'-- Capture the latest date
MyDate = .ItemOracleClearDate
End If[/COLOR]
End If
.MoveNext
Loop
End If
End With
If AllCleared Then
'-- All records have a valid date
Me.Parent.OracleClearDate = [COLOR="Red"]MyDate
Else
'-- Clear any existing date
Me.Parent.OracleClearDate = Null
[/COLOR]End If
EndFunction:
Exit Function
ErrUpdateParent:
MsgBox "Error No: " & Err.Number & vbCr & _
"Description: " & Err.Description
Resume EndFunction
End Function