Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Problem sa stazom

[es] :: Access :: Problem sa stazom

[ Pregleda: 1619 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

dejantomasevic
Beograd,Srbija

Član broj: 228071
Poruke: 63
*.static.sbb.rs.



Profil

icon Problem sa stazom22.09.2011. u 09:58 - pre 153 meseci
Kada saberem u koloni dani 15 i 25 dana i kada kliknem na dugme sracunaj dobijem 0 godina 0 meseci i 10 dana a trebao bih 0 godina 1 meseci i 10 dana.Neznam u čemu je problem?Molio bih nekog da mi pomogne kako da rešim ovaj problem.

Evo okačiću primer

Hvala unapred!

Prikačeni fajlovi
 
Odgovor na temu

SLOJ.1973

Član broj: 130198
Poruke: 871
*.dynamic.isp.telekom.rs.



+41 Profil

icon Re: Problem sa stazom22.09.2011. u 11:07 - pre 153 meseci
Pogresno si zavrsavao petlju.Evo pa pogledaj.Pozdrav.
Nisma video da ni godine ne sabira,evo sada bi trebalo da je ok.

[Ovu poruku je menjao SLOJ.1973 dana 22.09.2011. u 12:53 GMT+1]
Jednog dana...
Prikačeni fajlovi
 
Odgovor na temu

srdrazic

Član broj: 187994
Poruke: 509



+13 Profil

icon Re: Problem sa stazom22.09.2011. u 11:28 - pre 153 meseci
Jeste li proverili ispravljeni code, kod mene opet isto?

Kako mislite računati februar, prestupne godine i mesece sa 31 dan?
Teško je biti direktor a još teže ne biti!?
 
Odgovor na temu

dejantomasevic
Beograd,Srbija

Član broj: 228071
Poruke: 63
*.static.sbb.rs.



Profil

icon Re: Problem sa stazom22.09.2011. u 14:31 - pre 153 meseci
Sada imam problem oko zbrajanja meseci,jer kada saberem 0 godina 2 meseca 17 dana i 0 godina 5 meseci 15 dana i 1 godina 3 meseci 16 dana i 0 godina 0 meseci 12 dana dobijem 1 godina i 22 meseci.Opet nešto zeza.

Hvala unapred!
 
Odgovor na temu

banem
Kikinda

Član broj: 16619
Poruke: 583
*.dynamic.sbb.rs.



+15 Profil

icon Re: Problem sa stazom22.09.2011. u 15:08 - pre 153 meseci
Jedini problem je taj, što se staž ne računa tako. Uopšte, razlika dva datuma/vremena ne može tako da se računa. Postoje razne funkcije za to, npr. DateDiff(). Ili, malo prilagođeno ovako nešto:

Code:
Public Function GetElapsedInterval(dtStartDate As Date, dtEndDate As Date) _
As String
'Returns a formatted string yielding elapsed time.
'Doesn't handle negative date ranges i.e. dtEndDate > dtStartDate
'Input date/times between two ##, i.e. #9/10/1963 8:30AM#.
'  Function works for all date/times between January 1, 100 12:00:00AM
'    to December 31, 9999 11:59:59PM
'  Use existing Microsoft elapsed time functions
'    GetElapsedTime and Age to extend elapsed time to
'    include elapsed years and months
'Author:  K. Fisher 5/20/1998 [email protected]
'Sample usage:
'?basDate.GetElapsedInterval(#1/1/100 10:22PM#,Now())
'1898 Years 4 Months 18 Days 3 Hours 15 Minutes 53 Seconds
'?basDate.GetElapsedInterval(#5/19/1998 11:22:37PM#, #5/20/1998 12:39:54PM#)
'0 Years 0 Months 0 Days 13 Hours 17 Minutes 17 Seconds

Dim dtWorkingDate As Date       'working date/time

'Determine the elapsed years portion
Dim intYears As Integer
intYears = Age(dtStartDate, dtEndDate)
'34      =     9/18/1998    9/10/1963

'Determine the elapsed month portion
dtWorkingDate = DateAdd("yyyy", intYears, dtStartDate)
'9/10/97 8:30:00 PM = 34 years plus 9/10/1963 8:30PM
Dim intMonths As Integer
intMonths = DateDiff("m", dtWorkingDate, dtEndDate)
dtWorkingDate = DateAdd("m", intMonths, dtWorkingDate)
'5/10/98 8:30:00 PM = 8 months plus 9/10/97 8:30:00 PM

'Determine the elapsed days, hours, minutes, seconds portion
Dim dblInterval As Double
dblInterval = dtEndDate - dtWorkingDate
If dblInterval < 0 Then
    intMonths = intMonths - 1
    dblInterval = Abs(dblInterval + 1)
End If
'9.0766087962984 = 5/19/98 8:00:00 AM - 5/10/98 8:30:00 PM

'Assemble the formatted string
GetElapsedInterval = intYears & " Years " & intMonths & _
    " Months " & GetElapsedTime(dblInterval)

End Function

 Public Function Age(dtBirthday, dtAgeOnDate) As Integer
' Returns the Age in years between 2 dates
' Doesn't handle negative date ranges i.e. dtBirthday > dtAgeOnDate
' Input dates between two ##, i.e. #9/10/1963#.
' Source: Microsoft 1997 Neatcode.mdb
' Example:  Debug.Print basDate.Age(#9/10/1963#,Now())
    If Month(dtAgeOnDate) < Month(dtBirthday) Or _
       (Month(dtAgeOnDate) = Month(dtBirthday) And _
       Day(dtAgeOnDate) < Day(dtBirthday)) Then
      Age = Year(dtAgeOnDate) - Year(dtBirthday) - 1
    Else
      Age = Year(dtAgeOnDate) - Year(dtBirthday)
    End If
End Function


Iz ovoga izvuci šta ti odgovara.
Pozdrav,
Branislav
 
Odgovor na temu

[es] :: Access :: Problem sa stazom

[ Pregleda: 1619 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.