بحثت عن وحدة نمطية لحساب الفرق بين تاريخين
ووجدت لكني لم اعرف ان اطوعها كما اريد
فحاولت ان انشئ وحدة من تصميمي لتنفيذ ما اريد و لكني مازلت مبتدئ و الفشل يلاحقني في كل مكان 😂😂
و بإختصار
فكرتي كلآتي
طرح تاريخين من بعض
و بدأت بطرح السنين
فما الخطأ في الصورة
Function DatDiffY(Vdate1 As Date, Vdate2 As Date) As Integer
If Not (IsDate(Vdate1)) Then Exit Function
If Not (IsDate(Vdate2)) Then Exit Function
Dim year1 As intger
Dim year2 As intger
Dim month1 As intger
Dim month2 As intger
year1 = Int(DatePart("yyyy", Vdate1))
year2 = Int(DatePart("yyyy", Vdate2))
month1 = Int(DatePart("mm", Vdate1))
month2 = Int(DatePart("mm", Vdate2))
If month2 < month1 Then
DatDiffY = (year2 - year1) - 1
Else
DatDiffY = year2 - year1
End If
End Function
و شكرا لاساتذتي الكرام
اول خطأ في كلمة انتجر