PC Review


Reply
Thread Tools Rate Thread

Constructing a date

 
 
NevilleT
Guest
Posts: n/a
 
      27th May 2009
I am sure I have done this before but cannot work out how. I have a date
stored in dteStartDate. I want to calculate a date which is 16 quarters (4
years) after the quarter in which dteStartDate occurs.

Example. dteStartDate is 5 Jan 2009. Quarter starts on 1 Jan 2009 so the
date I am after is 31 Dec 2012

I have calculated which quarter the dteStartDate is in (1, 2, 3, 4) and
stored in lngQtr
I have tried the following without success. (I have only put in the first
quarter.)

If lngQtr = 1 Then
dteTemp = "#12/31/" & DateAdd("yyyy", 3, Year(dteStartDate)) & "#"

That causes an error.

I then tried:
If lngQtr = 1 Then
dteTemp = DateAdd("yyyy", Year(dteStartDate), #12:00:00 AM#)
dteTemp = DateAdd("m", 12, dteTemp)
dteTemp = DateAdd("d", 30, dteTemp)
End If

Used the # as I need to cater for 30/12/13 and 12/30/03. That put me in the
next century. I am sure there is a simple answer.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constructing a date NevilleT Microsoft Access VBA Modules 4 27th May 2009 11:14 PM
Constructing a New Database Christopher Microsoft Access Database Table Design 2 21st Mar 2008 03:26 PM
About xml constructing Reports to PDF files Microsoft Excel Programming 1 5th Jan 2008 05:17 PM
Constructing simple XML? Brett Romero Microsoft C# .NET 5 26th Jan 2006 09:41 AM
Constructing Classes Matthew Microsoft VB .NET 10 7th Oct 2004 06:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:47 AM.