' Return True if a date is empty ' expD1 Date Public Function EmptyDate(ByVal tdDate As Object) As Boolean Dim llEmpty As Boolean Dim ldDate As Date llEmpty = False ' Different providers handle the empty and null dates differently Select Case oApp.nSQLMode ' OleDb Case 1 ldDate = New Date(1899, 12, 30) If tdDate = ldDate Then llEmpty = True End If ' SQLClient Case 2 If tdDate Is DBNull.Value Then llEmpty = True End If ' ODBC Case 3 End Select Return llEmpty End FunctionAnd, this to return an empty date:
' Return an empty date ' expT1 Date Public Function GetEmptyDate() As Date Return New Date(1899, 12, 30, 0, 0, 0) End FunctionBut, in your case, you might want to verify for the DBNull.value such as:
If Not oRow(aField(lnCompteur2, 8)) Is DBNull.Value Then ldValue = oRow(aField(lnCompteur2, 8)) Else ldValue = oApp.GetEmptyDate() End If