Advertisement

05.21.2008 at 06:23AM PDT, ID: 23420681
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Help with VBA Code - Custom Function to Get Number of Calendar Days

Asked by bellegigi in Access Coding/Macros, Visual Basic Programming, SQL Query Syntax

Tags: , , ,

Hello, I need help with two things.

1) A custom function that returns the number of calendar days between two dates/times
2) Help with a custom function that I already have (it is below). This returns the number of business days. So, in a query if I put :Minutes: BusinessMin([LOGGED_DT],[RDate]), it will return the amount of minutes that have passed. However, if the minutes have then turned into an hour, day, etc... how do I get that to roll up and display? Do I need to specify that?

Function BusinessMin(StartDate As Date, EndDate As Date) As Long
    Dim WrkDays As Long
    Dim FirstDayMin As Long
    Dim LastDayMin As Long
    Dim InterDayMin As Long
    Dim DaySpan As Long, WeekSpan As Long
    Dim totaldays As Long, Totalhours As Long, totalminutes As Long
    Dim days As Long, hours As Long, Minutes As Long

       
    Const InTime As Date = #8:30:00 AM#
    Const OutTime As Date = #5:00:00 PM#
    Const WorkMin As Integer = 510
   
    DaySpan = DateDiff("d", StartDate, EndDate)
   
    If DaySpan >= 7 Then
        WeekSpan = Int(CSng(DaySpan / 7))
        DaySpan = DaySpan Mod 7
        Do While WeekSpan > 0
            WeekSpan = WeekSpan - 1
            DaySpan = DaySpan + 5
        Loop
    Else
        If DaySpan >= 5 Then
            DaySpan = DaySpan - 2
        Else
            If DaySpan >= 3 Then
                If DatePart("w", StartDate, 2) >= 3 Then
                    DaySpan = DaySpan - 2
                End If
            End If
        End If
    End If
   
    If DaySpan > 0 Then
        DaySpan = DaySpan - 1
        FirstDayMin = DateDiff("n", TimeValue(StartDate), OutTime)
           If FirstDayMin < 0 Then
               FirstDayMin = 0
           End If
        LastDayMin = DateDiff("n", InTime, TimeValue(EndDate))
           If LastDayMin < 0 Then
               LastDayMin = 0
           End If
        InterDayMin = DaySpan * WorkMin
        BusinessMin = FirstDayMin + InterDayMin + LastDayMin
    Else
        BusinessMin = DateDiff("n", StartDate, EndDate)
       
    End If
 
         
End Function
Start Free Trial
[+][-]05.21.2008 at 06:26AM PDT, ID: 21614758

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Visual Basic Programming, SQL Query Syntax
Tags: Microsoft, Access 2003, Access 2003, VBA
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.21.2008 at 06:29AM PDT, ID: 21614785

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 06:35AM PDT, ID: 21614842

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 06:44AM PDT, ID: 21614933

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 06:45AM PDT, ID: 21614946

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 07:04AM PDT, ID: 21615126

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 09:43AM PDT, ID: 21616835

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 10:08AM PDT, ID: 21617032

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.21.2008 at 10:20AM PDT, ID: 21617137

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 10:23AM PDT, ID: 21617155

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 10:26AM PDT, ID: 21617174

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:00PM PDT, ID: 21617972

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 11:04AM PDT, ID: 21662710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.21.2008 at 05:38PM PDT, ID: 22285505

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 01:57AM PDT, ID: 22332656

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628