Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

Help with elseif.....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JP - 04 Feb 2005 14:07 GMT
We have a database that records the ship date and receipt date and we are
trying to disregard weekends and holidays.  The problem is that it only
disregards the first weekend and then the elseif is met and it quits.  If a
transit goes over two weekends (for example, takes 14 calendar days in
transit), then only the first weekend is credited.  How should the elseif
read?  Here's what we have for January, for example:
Function IT(SDAY As Date, RDAY As Date)
If #12/24/2004# >= SDAY And #12/27/2004# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #12/31/2004# >= SDAY And #1/3/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #1/8/2005# >= SDAY And #1/9/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/15/2005# >= SDAY And #1/16/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/22/2005# >= SDAY And #1/23/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/29/2005# >= SDAY And #1/30/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
Else: IT = RDAY - SDAY
End If
End Function
Lynn Trapp - 04 Feb 2005 14:29 GMT
Trying to maintain that function is going to be a nightmare, because you are
going to have to modify it everytime a new month rolls around. Let me
suggest you take a look at the following website and see if you can modify
the code to work for you.

http://www.mvps.org/access/datetime/date0006.htm

Signature

Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm

> We have a database that records the ship date and receipt date and we are
> trying to disregard weekends and holidays.  The problem is that it only
[quoted text clipped - 19 lines]
> End If
> End Function
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.