Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

access 2010 vba calculate dates

Posted on 2014-04-24
4
Medium Priority
?
653 Views
Last Modified: 2014-04-24
Hi,

I have a query regarding using vba to calculate due dates.

Overview:
i have a form where the user enters an start date for a contract. What i need to do is, after the start date has been entered, auto calculate 2 different dates based upon the month of the start date.

i.e. if the start date entered is any day in January, for example 05/01/2014, then due date to be calculated should be 01/03/2014, settlement date to be calculated should be 31/03/2014.

Start Date                Due Date             Settlement Date
any day in Jan           01/03/2014          31/03/2014
any day in Feb          01/04/2014          30/04/2014
etc etc

Many thanks
0
Comment
Question by:andrewpiconnect
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1000 total points
ID: 40019565
DueDate = DateSerial(Year([StartDate]), Month([StartDate]) + 2, 1)

SettlementDate = DateSerial(Year([StartDate]), Month([StartDate]) + 4, 0)
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 40019790
SettlementDate exceeds by a month

should be
SettlementDate = DateSerial(Year([StartDate]), Month([StartDate]) + 3, 0)
0
 

Author Closing Comment

by:andrewpiconnect
ID: 40019884
Thanks Guys....works a treat
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 40020032
Thanks for catching that Rey, I hate dd/mm/yy format!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question