Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Developers    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Return a date
Juan C Rivera 
            
3 years ago
Hi Y'all I solved the Acces to word issues and moving on to my next step.   I am trying to return a date by providing a startdate, numberofdays and return a network date.  I am following the video from Richard but in his video he return a number based on two dates.  I am building a milestone chart and have set number of days to do a task.  for exsample task A stats on 2023-02-01 and you have 10 days to deliver what date will it return

Public Function MyEndDate(startdate As Date, DaysforTask As Long) As Date
  Dim S As Date, D As Long
  D = DaysforTask
  S = startdate
  MsgBox S & " - " & D
  While D <> 0
    If Weekday(S) > 1 And Weekday(S) < 7 Then MyEndDate = MyEndDate + 1
    MsgBox MyEndDate
    D = D - 1
    MsgBox MyEndDate
  Wend
End Function


this returns 12:00 what did I miss?

V/r
Juan
Kevin Robertson  @Reply  
           
3 years ago
Try this. See if it works for you.

Public Function MyEndDate(StartDate As Date, DaysForTask As Long) As Date

    Dim S As Date, D As Long
    
    D = DaysForTask
    S = StartDate

    While D <> 0
        If Weekday(S) = 7 Then
            S = S + 3
        ElseIf Weekday(S) = 1 Then
            S = S + 2
        Else
            S = S + 1
        End If
        D = D - 1
    Wend
    
    MyEndDate = S

End Function
Alex Hedley  @Reply  
           
3 years ago
Juan C Rivera OP  @Reply  
            
3 years ago
Big Thanks Kevin and Alex.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developers.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/24/2026 2:28:25 PM. PLT: 0s