|
-
Dec 4th, 2001, 11:41 PM
#1
Thread Starter
New Member
How do I add 7 days to a date?
Hello. I'm writing a program to simplify my business. Basically, you choose what you want to send-
1)letter to prospect concerning their resume
2)letter to prospect telling them when training meeting is
3)letter to prospect confirming their reservation
4)letter to city leader confirming prospect's reservation
Everything is pretty automatic, and for good reason. When this is finished, I'm distributing it to all representatives in the company.
I have them enter the meeting date as follows:
month (MM) in txtMeeting1
day (DD) in txtMeeting2
year (YY) in txtMeeting3
Then, it prints the date of the meeting in the letter to the prospect/city leader, plus the date of next week's meeting. I don't know how to accomplish the latter. Could someone please help me out? How do I take the date I enter and make another date that's exactly 7 days after that? I'm totally lost 
Thanks
BLiNDPiG
------------------
"I always wanted to be somebody, but I should have been more
specific."
BLiNDPiG-
http://villa.lakes.com/BLiNDPiG
-
Dec 4th, 2001, 11:46 PM
#2
Something like this:
Code:
dateadd("d",7,YourDate)
Hope this helps,
-
Dec 5th, 2001, 12:12 AM
#3
Thread Starter
New Member
Originally posted by Negative0
Something like this:
Code:
dateadd("d",7,YourDate)
Hope this helps,
Alrighty, thanks... two problems though. One: where do I put the code? Right now, my date isn't a string, but rather 3 separate text boxes (txtmeeting1.text is the month, txtmeeting2.text is the day, and txtmeeting3.text is the year)
Second: What if the first date is less than seven days from the end of the month?
Sidenote- is there a better way to have them enter in the date? I'd like to keep it as consistent and [cough] simple as possible, which is why I chose 3 separate text boxes. Any suggestions?
Thanks for the help
BLiNDPiG
------------------
"I always wanted to be somebody, but I should have been more
specific."
BLiNDPiG-
http://villa.lakes.com/BLiNDPiG
-
Dec 5th, 2001, 12:17 AM
#4
You can use the DateSerial-Fct. for this :
Dateserial(year, month, day)
dateadd("d",7,Dateserial(Cint(txtmeeting3.text ), Cint(txtmeeting2.text),cint(txtmeeting1.text ) )
Bye,
André
-
Dec 5th, 2001, 12:19 AM
#5
You can do something like this then
Code:
dim currdate as date
dim nextdate as date
CurrDate = cdate(text1.text & "/" & text2.text & "/" & text3.text )
NextDate = DateAdd("d",7,currdate)
So lets say currdate = 11/28/2001 then NextDate=12/5/2001
To allow the user to enter a date you can use the date/time picker which is available through one of the Windows Common Controls 6.0 Components.
Hope this helps,
-
Dec 5th, 2001, 06:39 PM
#6
VB Code:
Private Sub Command1_Click()
Dim OneWeek As Date
OneWeek = Now + 7
MsgBox Format(OneWeek, "mm/dd/yyyy")
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|