الأحد، 24 ديسمبر 2017

Add days to a variable date


اضافة ايام الى تاريخ متغير

المطلوب ان يعطي التاريخ الناتج يوم 28 من نفس الشهر ونفس السنة
واذا كان اليوم يساوي 28  في التاريخ المتغير  فانه يعطي يوم 28 للشهر التالي 
Required                                                                                                                         
The resulting date is given on the 28th of the same month and the same year
If today is 28 in the variable history it gives the 28th day of the following month

وتم عمل مثال اخر  بالاستعلام
Another example was the query
يصير هذا الكود ضمن الاستعلام
Expr1: IIf(Day([date1])=28,DateAdd("m",1,[date1]),28 & Format([date1],"/mm/yyyy"))



إضافة تسمية توضيحية

ملاحظات



إضافة تسمية توضيحية



اذا كان التاريخ اكبر من يوم 28 في الشهر الحالي يعطيني 28 في الشهر التالي
If the date is greater than the 28th day of the current month it gives 28 the following month


Expr1: IIf(Day([date1])>=28,28 & Format(DateAdd("m",1,[date1]),"/mm/yyyy"),28 & Format([date1],"/mm/yyyy"))

اذا كان التاريخ المتغير  يتجاوز تاريخ الجهاز فانه يعطي التاريخ المتغير
If the variable date is greater than the date of the device it gives the variable date
اذن غير الكود الى هذا

IIf([date1]>=Date(),Date(),IIf(Day([date1])>=28,28 &
Format(DateAdd("m",1,[date1]),"/mm/yyyy"),28 & Format([date1],"/mm/yyyy")))


إضافة تسمية توضيحية



اذا كان  الشهر  في التاريخ المتغير  يساوي  شهر  التاريخ الحالي  فانه يعطي التاريخ الحالي
If the month in the variable date equals the month in the current date it gives the current date

Expr1:IIf([date1]>=Date(),Date(),IIf(Month([date1])=Month(Date()),Format(Date(),"dd/mm/") & Year([date1]),IIf(Day([date1])>=28,28 & Format(DateAdd("m",1,[date1]),"/mm/yyyy"),28 & Format([date1],"/mm/yyyy"))))
اذا كان  الشهر  في التاريخ المتغير  يساوي  شهر  التاريخ الحالي  فانه يعطي 28 من الشهر الماضي 
If the month in the variable date equals the current date month it gives 28 of the previous month 
Expr1: IIf(Month([date1])=Month(Date()),28 & "/" & Month([date1])-1 & "/" &
Year([date1]),IIf(Day([date1])>=28,28 & Format(DateAdd("m",1,[date1]),"/mm/yyyy"),28 &
Format([date1],"/mm/yyyy"))) 


رابط تحميل القاعدة
الموضوع بالمنتدي
الشرح  الفيديو 





0 التعليقات:

إرسال تعليق

شارك