21. februar 2007 - 14:19
Der er
16 kommentarer og 1 løsning
Deadline = Registreringsdato + 4 hverdage
Dette en med garanti omtalt tidligere i Acces-kategorien, men jeg kan ikke umiddelbart finde nogen god henvisning. På baggrund af en given brugers indtastning af nogle data, skal denne have oplyst ny deadline for opfølgning på sagen, som er : 4 hverdage efter 1. registreringsdato Nogen ideer / løsningsforslag
Annonceindlæg tema
Forsvar & beredskab
Cybersikkerhed, realtidsdata og robuste it-systemer er blevet fundamentet for moderne forsvar.
21. februar 2007 - 14:30
#2
21. februar 2007 - 14:31
#3
that last link was more to SQL Server
21. februar 2007 - 15:29
#4
I´m sorry, but I can´t see how this would work ... hint ?
21. februar 2007 - 15:41
#5
The function
http://support.microsoft.com/kb/210562 is called with two dates and it returns the number of working days between the two.
So if you call it with the registreringsdato and dateadd 4 days to that it will return 4 or less
If it returns less then you add another day and call it again until it returns 4.
So now you have the Registreringsdato + 4 hverdage, dont you?
21. februar 2007 - 15:42
#6
but NOTE: ' Note that this function does not account for holidays
21. februar 2007 - 15:45
#7
Yes, I can see that, but Work_Days(#21-02-2007#;#25-02-2007#) returns 5 days, and not 3 as I have expected ( not counting sat and sun )
21. februar 2007 - 15:54
#8
I had expected that this : If Format(DateCnt, "ddd") <> "Sun" And _ Format(DateCnt, "ddd") <> "Sat" Then EndDays = EndDays + 1 End If would have taken care of it, but it doesn´t seem to work
21. februar 2007 - 15:56
#9
I'll have a play with it to see whats happening.
21. februar 2007 - 15:56
#10
Work_Days(#21-02-2007#;#25-02-2007#) returns 3 here
21. februar 2007 - 15:58
#11
Try calling it with Work_Days(#2007-02-21#,#2007-02-25#)
21. februar 2007 - 16:04
#12
And youcan use this to add your days Function Add4WorkingDays(inDate As Date) As Date Dim outDate As Date Dim i As Integer outDate = DateAdd("d", 4, inDate) i = Work_Days(inDate, outDate) Do Until i = 4 outDate = DateAdd("d", 1, outDate) i = Work_Days(inDate, outDate) Loop End Function
21. februar 2007 - 18:32
#13
I´m sorry, I simply can´t make it work ... the last function you made, creates a Error 6 overflow. There must be somethint wrong with my installation
21. februar 2007 - 18:57
#14
if you have danish regional settings then you will need to change , ; in functions.
21. februar 2007 - 19:26
#15
This solved the problem ... my mistake Format(DateCnt, "ddd") <> "sø" And _ Format(DateCnt, "ddd") <> "lø" Then
21. februar 2007 - 20:01
#16
thanks, great to see it works, but it will very likley give problems if different regional settings are used. Maybe it can be modified to take the day number instead
22. februar 2007 - 02:40
#17
You can always use the Weekday function instead - that's what I would do...
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser