Normal Topic Date's (Read 502 times)
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
Date's
Apr 9th, 2008 at 11:25pm
Print Post Print Post  
I know i have seen this somewhere here before.

I have four LE's

Start Date
1st month
second month
third month

I have written a calander line that allows to select a date, which will always be the 1st the the following month ie 1st of May, what I am wanting is when the "Start Date" le is full, the other three LE's will populitae with the date's with the 1st of the following months ie 1st June, 1st July etc...


Help please.

Thanks once again for a great product.
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Date's
Reply #1 - Apr 10th, 2008 at 1:19am
Print Post Print Post  
Just to be clear, do these lines represent what you want?   (Format is m\d\y)

StartDate = 1/1/yy,  Date1 = 2/1/yy, Date2 = 3/1/yy, Date3 = 4/1/yy
StartDate = 4/14/yy, Date1 = 5/1/yy, Date2 = 6/1/yy, Date3 = 7/1/yy
StartDate = 6/22/yy, Date1 = 7/1/yy, Date2 = 8/1/yy, Date3 = 9/1/yy
StartDate = 8/27/yy, Date1 = 9/1/yy, Date2 = 10/1/yy, Date3 = 11/1/yy
StartDate = 11/7/yy, Date1 = 12/1/yy, Date2 = 1/1/yy+1, Date3 = 2/1/yy+1 ?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Date's
Reply #2 - Apr 10th, 2008 at 1:57am
Print Post Print Post  
If my samples above were correct, then this is an untested concept

Code
Select All
vMonth1 as String
vMonth2 as String
vMonth3 as String

vYear1 as String
vYear2 as String
vYear3 as String

// Calculate the month allowing for running into the next year
vMonth1 = @Mod(StartDate + 1, 12); If vMonth1 = 0, then vMonth1 = 1
vMonth2 = @Mod(StartDate + 2, 12); If vMonth2 = 0, then vMonth2 = 1
vMonth3 = @Mod(StartDate + 3, 12); If vMonth3 = 0, then vMonth3 = 1

// Calculate the year allowing for running into the next year
If vMonth1 < @Month(StartDate) Then
     vYear1 = @Year(StartDate) + 1
	Else
	vYear1 = @Year(StartDate)

If vMonth2 < @Month(StartDate) Then
     vYear2 = @Year(StartDate) + 1
	Else
	vYear2 = @Year(StartDate)

If vMonth3 < @Month(StartDate) Then
	vYear3 = @Year(StartDate) + 1
	Else
	vYear3 = @Year(StartDate)

// Create the final dates
vMonth1 = vMonth1 + "/1/" + vYear1
vMonth2 = vMonth2 + "/1/" + vYear2
vMonth3 = vMonth3 + "/1/" + vYear3
 



Note:  May need to change last vMonthx values into Dates

If my samples were wrong, then at least this may give you the ideas you need to get started. 
A key part of this us using @Mod to handle the date rollover into the next year.
« Last Edit: Apr 10th, 2008 at 3:22am by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
Re: Date's
Reply #3 - Apr 10th, 2008 at 2:53am
Print Post Print Post  
Kind of

Client enters a date into Start Date of for example 01/04/2008 (D/M/YYYY) the start date will always be the first of each month, i want the other les 1st month 2nd month, to automaticly place in the following months but each one has to be that 1st.
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Date's
Reply #4 - Apr 10th, 2008 at 3:16am
Print Post Print Post  
That is what I have done, but did not change DateEntered to StartDate of the first, like this

StartDate=@Month(DateEntered) + "/1/" + @Year(DateEntered)
followed by code above.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged