ثم ننشئ تكست 4 و 5 و 6 و نجعل الاندكس لكل منهم 0 ثم ننسخهم 6 مرات حيث الاندكس 0 لشهر يناير و الاندكس 1 لشهر شباط .........الخ
و الاندكس 5 للمجموع مع ملاحظة جعلعم مخفيين
ثم ننشئ 2 كوماند واحد للسابق و الآخر للتالي
نكتب في اي منهما الكود التالي نفسه مع تغيير السطر السابع المشار اليه ب * باحدى الكودين Adodc1.Recordset.movenext h او Adodc1.Recordset.MovePrevious
كود :
For i = 0 To 5
text4(i).Visible = False
text5(i).Visible = False
text6(i).Visible = False
Next
on error resume next
*
p = DTPicker2.Month - DTPicker1.Month
s = DTPicker2.Year
ss = s / 4
Dim sss As Integer
sss = ss
w = ss = sss
If w = 0 Then
m = 29
Else: m = 28
End If
If p = 0 Then
y = DTPicker2.Month - 1
If Text3.Text = "عارضة" Then
text4(y).Visible = True
text4(y).Text = Text2.Text
End If
If Text3.Text = "طارئة" Then
text5(y).Visible = True
text5(y).Text = Text2.Text
End If
If Text3.Text = "دورية" Then
text6(y).Visible = True
text6(y).Text = Text2.Text
End If
Else
x = DTPicker1.Month
z = DTPicker2.Month
For i = x To z
y = i - 1
If i = 1 Or i = 3 Or i = 5 Then
If i = DTPicker1.Month Then
q = DTPicker1.Day
qq = 31 - q
End If
If i = DTPicker2.Month Then
q = DTPicker2.Day
qq = 31 - q
End If
If Not i = DTPicker1.Month And Not i = DTPicker2.Month Then qq = 31
End If
If i = 2 Then
If i = DTPicker1.Month Then
q = DTPicker1.Day
qq = m - q
End If
If i = DTPicker2.Month Then
q = DTPicker2.Day
qq = m - q
End If
If Not i = DTPicker1.Month And Not i = DTPicker2.Month Then qq = m
End If
If i = 4 Then
If i = DTPicker1.Month Then
q = DTPicker1.Day
qq = 30 - q
End If
If i = DTPicker2.Month Then
q = DTPicker2.Day
qq = 30 - q
End If
If Not i = DTPicker1.Month And Not i = DTPicker2.Month Then qq = 30
End If
If Text3.Text = "عارضة" Then
text4(y).Visible = True
text4(y).Text = qq
End If
If Text3.Text = "طارئة" Then
text5(y).Visible = True
text5(y).Text = qq
End If
If Text3.Text = "دورية" Then
text6(y).Visible = True
text6(y).Text = qq
End If
ولكن اخي الكود يعتمد على اظهار القيمة فى الخانة التى بها الاجازة
ولكن المطلوب اخي الكريم هو رصد الاجازة بمعنى عندما يحصل على اجازة 73 يوم
15/3/2014 الى 26/5/2014
اريد فردها كا التالي على الاشهر شهر مارس من 15 الى 31 =17 يوم