Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:40:02+00:00 2026-06-08T03:40:02+00:00

I am running the below expression to compare the diffence of 2 dates. If

  • 0

I am running the below expression to compare the diffence of 2 dates. If both dates are in the cell I would like it to return a 0 but if Date2 is blank I would like the difference to show. Right now I just get #ERROR if there is no date in date2. Any ideas would be greatly appreciated.

expr2: NetWorkDays([Date1],[Date2])

Option Compare Database 

Public Function NetWorkdays(dteStart As Date, dteEnd As Date) As Integer 

Dim intGrossDays As Integer 
Dim dteCurrDate As Date 
Dim i As Integer 

intGrossDays = DateDiff("d", dteStart, dteEnd) 
NetWorkdays = 0 

For i = 0 To intGrossDays 
dteCurrDate = dteStart + i 
If Weekday(dteCurrDate, vbMonday) < 6 Then 
End If 
Next i 

End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:40:04+00:00Added an answer on June 8, 2026 at 3:40 am

    The function will always return 0 if you don’t remove the NetWorkdays = 0 from the function, and you will continue you to get an error if you don’t wrap where you call the function in an if statement like this:

    If Not IsNull(Date2) Then
    txtResult = NetWorkdays(Date1, Date2)
    Else
    txtResult = 0
    End If
    

    txtResult being the textbox you want to display your results in.

    You may want to look at this link http://msdn.microsoft.com/en-us/library/bb258196(v=office.12).aspx. It is a function designed for access to calculate the number of workdays between two dates.

    Using this function you should get the results you want doing something like this:

    If Not IsNull(Date2) Then
    txtResult = 0
    Else
    txtResult = Work_Days(Date1, Now())
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running the query below in Sybase application which works great but the
I'm running ant and added the below to build.xml but I'm getting:\ build.xml:51: Element
I'm running the below script to test something but it seems it's not working.
I am running below code as root and using python2.6.1, platform is linux >>>
Hello friends i am running code given below which contains the setLogTimeEntery function and
I receive the error below when running the following function. The catch says the
I get the following error when running the code below: invalid byte sequence in
I am getting an argument of length zero after running the code below. I
while running: rake snorby:setup getting below error: rake aborted! You have already activated rake
While running the code I've included below I receive the error EntityCommandExecutionException was unhandled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.