|
-
May 22nd, 2001, 12:19 PM
#1
Registered User
Business Days
A user inputs a date and I need to have the program search for data matching the date inputted as well as anything 5 business days prior (minus holidays as well).
any idea how to code this?
-
May 23rd, 2001, 02:17 AM
#2
Erm ... you might want to be a little bit more specific, like telling us which programming language you are using, if you're using a database and what sort, or did you just want a solution in anything?
-
May 23rd, 2001, 06:31 AM
#3
Registered User
-
May 23rd, 2001, 08:19 AM
#4
Originally posted by Blue Falcon:I'm using Access 97.
OK ... so that's your database, but are you writing your own forms, using Access Reports, using a Visual Basic front end, doing an SQL Query...?
Give us some clues!
-
May 23rd, 2001, 08:41 AM
#5
Registered User
My Bad. I'm just using plain ol' Access 97 to do everything. Nothing extra.
-
May 23rd, 2001, 08:57 AM
#6
Registered User
Well, I guess I could use VB as a module.
You'll have to forgive me, I'm just learning Access.
-
May 23rd, 2001, 09:09 AM
#7
In your form, where the date is input, you can use the DateAdd() internal function to find the entered date -5 days:
Code:
sStartDate = DateAdd("d", -5, sInputDate)
If you want to ensure that the sStartDate is a workday (ie, mon-fri) then you want to use the Format() function (See Format Characters):
Code:
SELECT CASE (Format(sStartDate, "w"))
CASE 1:
' this is a sunday
sStartDate = DateAdd("d", -2, sStartDate)
CASE 7:
' this is a saturday
sStartDate = DateAdd("d", -1, sStartDate)
END SELECT
So what we've done is changed it to the Friday if it's a saturday or sunday.
You can now safely search between your two dates.
In SQL:
... WHERE [EntryDate] BETWEEN [STARTDATE] AND [INPUTDATE]
-
May 31st, 2001, 09:57 AM
#8
Registered User
Ok, I just learned that it is for 20 business days, not just 5. Any suggestions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks