[FORM] Hizmet yılı hesaplama
#1
personelin hizmet yılını gün ay yıl olarak hesaplatmak istiyorum. ama #Ad? hatası alıyorum. bunun sebebi nedir.


Eklenti Dosyaları
.rar   hizmet yılı.rar (Boyut: 27,59 KB / İndirilme: 50)



  Alıntı
Bu mesajı beğenenler:
#2
formu tasarım görünümünde açıp inceleyiniz sizin hatanız modül eklememişsiiniz module1 adında tarih hesaaplayan modul eklenmiştir kendiinize göre formu düzenleyin


Eklenti Dosyaları
.rar   hizmet yılı.rar (Boyut: 28,02 KB / İndirilme: 59)



  Alıntı
Bu mesajı beğenenler:
#3
modül olmadan hesaplama yapmamız mümkün değilmidir



  Alıntı
Bu mesajı beğenenler:
#4
sorunumu hala çözmüş değilim yardımlarınızı bekliyorum



  Alıntı
Bu mesajı beğenenler:
#5
tarih 2 nin varsayılan değerine =Date() yazılmıştır.sorununuz çözülmüştür.modül1 e göre ilk tarih ikinci tarihten büyük olmalı.Tarih kısmı boş olduğundan söz konusu koşul sağlanamadığından hata mesajı alıyorsunuz. kolay gelsin


Eklenti Dosyaları
.rar   hizmet yılıson.rar (Boyut: 30,59 KB / İndirilme: 69)



  Alıntı
Bu mesajı beğenenler:
#6
Ben şöyle bir kod buldum onu kulanıyorum,
Dentim kaynagına alttaki fonksiyonu yazıyorum,
=Diff2Dates("ymd";[MemBasTar];Date();Doğru)
[MemBasTar] =anlaşıldığı gibi ilk başlangıç tarihinin
alanını yazıyorsun buraya
bir module açın bunları içine kopyalayın,

Visual Basic
  1. Option Compare Database
  2. Option Explicit
  3. '***************** Code Start **************
  4. Public Function Diff2Dates(Interval As String, Date1 As Date, Date2 As Date, _
  5. Optional ShowZero As Boolean = False) As Variant
  6. On Error GoTo Err_Diff2Dates
  7.  
  8. Dim booCalcYears As Boolean
  9. Dim booCalcMonths As Boolean
  10. Dim booCalcDays As Boolean
  11. Dim booCalcHours As Boolean
  12. Dim booCalcMinutes As Boolean
  13. Dim booCalcSeconds As Boolean
  14. Dim booSwapped As Boolean
  15. Dim dtTemp As Date
  16. Dim intCounter As Integer
  17. Dim lngDiffYears As Long
  18. Dim lngDiffMonths As Long
  19. Dim lngDiffDays As Long
  20. Dim lngDiffHours As Long
  21. Dim lngDiffMinutes As Long
  22. Dim lngDiffSeconds As Long
  23. Dim varTemp As Variant
  24.  
  25. Const INTERVALS As String = "dmyhns"
  26.  
  27. 'Check that Interval contains only valid characters
  28. Interval = LCase$(Interval)
  29. For intCounter = 1 To Len(Interval)
  30. If InStr(1, INTERVALS, Mid$(Interval, intCounter, 1)) = 0 Then
  31. Exit Function
  32. End If
  33. Next intCounter
  34.  
  35. 'Check that valid dates have been entered
  36. If Not (IsDate(Date1)) Then Exit Function
  37. If Not (IsDate(Date2)) Then Exit Function
  38.  
  39. 'If necessary, swap the dates, to ensure that
  40. 'Date1 is lower than Date2
  41. If Date1 > Date2 Then
  42. dtTemp = Date1
  43. Date1 = Date2
  44. Date2 = dtTemp
  45. booSwapped = True
  46. End If
  47.  
  48. Diff2Dates = Null
  49. varTemp = Null
  50.  
  51. 'What intervals are supplied
  52. booCalcYears = (InStr(1, Interval, "y") > 0)
  53. booCalcMonths = (InStr(1, Interval, "m") > 0)
  54. booCalcDays = (InStr(1, Interval, "d") > 0)
  55. booCalcHours = (InStr(1, Interval, "h") > 0)
  56. booCalcMinutes = (InStr(1, Interval, "n") > 0)
  57. booCalcSeconds = (InStr(1, Interval, "s") > 0)
  58.  
  59. 'Get the cumulative differences
  60. If booCalcYears Then
  61. lngDiffYears = Abs(DateDiff("yyyy", Date1, Date2)) - _
  62. IIf(Format$(Date1, "mmddhhnnss") <= Format$(Date2, "mmddhhnnss"), 0, 1)
  63. Date1 = DateAdd("yyyy", lngDiffYears, Date1)
  64. End If
  65.  
  66. If booCalcMonths Then
  67. lngDiffMonths = Abs(DateDiff("m", Date1, Date2)) - _
  68. IIf(Format$(Date1, "ddhhnnss") <= Format$(Date2, "ddhhnnss"), 0, 1)
  69. Date1 = DateAdd("m", lngDiffMonths, Date1)
  70. End If
  71.  
  72. If booCalcDays Then
  73. lngDiffDays = Abs(DateDiff("d", Date1, Date2)) - _
  74. IIf(Format$(Date1, "hhnnss") <= Format$(Date2, "hhnnss"), 0, 1)
  75. Date1 = DateAdd("d", lngDiffDays, Date1)
  76. End If
  77.  
  78. If booCalcHours Then
  79. lngDiffHours = Abs(DateDiff("h", Date1, Date2)) - _
  80. IIf(Format$(Date1, "nnss") <= Format$(Date2, "nnss"), 0, 1)
  81. Date1 = DateAdd("h", lngDiffHours, Date1)
  82. End If
  83.  
  84. If booCalcMinutes Then
  85. lngDiffMinutes = Abs(DateDiff("n", Date1, Date2)) - _
  86. IIf(Format$(Date1, "ss") <= Format$(Date2, "ss"), 0, 1)
  87. Date1 = DateAdd("n", lngDiffMinutes, Date1)
  88. End If
  89.  
  90. If booCalcSeconds Then
  91. lngDiffSeconds = Abs(DateDiff("s", Date1, Date2))
  92. Date1 = DateAdd("s", lngDiffSeconds, Date1)
  93. End If
  94.  
  95. If booCalcYears And (lngDiffYears > 0 Or ShowZero) Then
  96. varTemp = lngDiffYears & IIf(lngDiffYears <> 1, " Yıl", " Yıl")
  97. End If
  98.  
  99. If booCalcMonths And (lngDiffMonths > 0 Or ShowZero) Then
  100. If booCalcMonths Then
  101. varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  102. lngDiffMonths & IIf(lngDiffMonths <> 1, " Ay ", " Ay")
  103. End If
  104. End If
  105.  
  106. If booCalcDays And (lngDiffDays > 0 Or ShowZero) Then
  107. If booCalcDays Then
  108. varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  109. lngDiffDays & IIf(lngDiffDays <> 1, " Gün", " Gün")
  110. End If
  111. End If
  112.  
  113. If booCalcHours And (lngDiffHours > 0 Or ShowZero) Then
  114. If booCalcHours Then
  115. varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  116. lngDiffHours & IIf(lngDiffHours <> 1, " hours", " hour")
  117. End If
  118. End If
  119.  
  120. If booCalcMinutes And (lngDiffMinutes > 0 Or ShowZero) Then
  121. If booCalcMinutes Then
  122. varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  123. lngDiffMinutes & IIf(lngDiffMinutes <> 1, " minutes", " minute")
  124. End If
  125. End If
  126.  
  127. If booCalcSeconds And (lngDiffSeconds > 0 Or ShowZero) Then
  128. If booCalcSeconds Then
  129. varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  130. lngDiffSeconds & IIf(lngDiffSeconds <> 1, " seconds", " second")
  131. End If
  132. End If
  133.  
  134. If booSwapped Then
  135. varTemp = "-" & varTemp
  136. End If
  137.  
  138. Diff2Dates = Trim$(varTemp)
  139.  
  140. End_Diff2Dates:
  141. Exit Function
  142.  
  143. Err_Diff2Dates:
  144. Resume End_Diff2Dates
  145.  
  146. End Function
  147. '************** Code End *****************





  Alıntı
Bu mesajı beğenenler:


Benzer Konular...
Konu: Yazar Cevaplar: Gösterim: Son Mesaj
  Dini Bayramları Hesaplama Hatası Ahmet51 11 272 1 saat önce
Son Mesaj: dsezgin
  Bir Sütuna Girilen Verileri Başka Bir Sütun Ile Karşılaştırıp Hesaplama bilservisci 4 242 08-01-2024, 11:58
Son Mesaj: bilservisci
  Faiz Hesaplama cirdakc 2 137 17-08-2023, 18:00
Son Mesaj: cirdakc
  [FORM] Liste Kutusundaki Veriye Göre Stok Ve Ihtiyaç Verisini Otomatik Hesaplama husem 2 232 08-06-2023, 19:03
Son Mesaj: husem
  Hesaplama Yapılan Alanlar Boş Görünüyor ankaram 4 167 08-11-2022, 13:02
Son Mesaj: ankaram
access-sql-9 [VBA] Periyot Hesaplama alperalper 7 358 07-08-2022, 12:13
Son Mesaj: alperalper
  [SORGU] Süre Hesaplama Access Ziyaretçisi 2 182 06-08-2022, 20:05
Son Mesaj: Access Ziyaretçisi
  [SORGU] Access Ardışık Satırlarda Tarih Farkını Hesaplama Hakkında ! sduta 3 227 17-03-2022, 21:23
Son Mesaj: sduta

Foruma Git:


Bu konuyu görüntüleyen kullanıcı(lar): 1 Ziyaretçi