Results 1 to 6 of 6

Thread: How do I add 7 days to a date?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    11

    Question 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

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Something like this:

    Code:
    dateadd("d",7,YourDate)
    Hope this helps,

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    11
    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

  4. #4
    arausch
    Guest
    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é

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    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,

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim OneWeek As Date
    3. OneWeek = Now + 7
    4. MsgBox Format(OneWeek, "mm/dd/yyyy")
    5. 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
  •  



Click Here to Expand Forum to Full Width