Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2011, 02:52 AM
macropod's Avatar
macropod macropod is offline Creating a date box Windows 7 32bit Creating a date box Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Philip,



Assuming your textboxes are on a userform and are named TextBox1, TextBox2 & TextBox3, with the date in TextBox1 and the # days in TextBox2, try:
Code:
Private Sub TextBox1_AfterUpdate()
If TextBox2.Value = "" Then TextBox2.Value = 0
MsgBox DateAdd("d", CInt(TextBox2.Value), CDate(TextBox1.Text))
TextBox3.Text = Format(DateAdd("d", CInt(TextBox2.Value), CDate(TextBox1.Text)), "DD/MMMM/YYYY")
End Sub
 
Private Sub TextBox2_AfterUpdate()
If TextBox1.Text = "" Then TextBox1.Text = Format(Now, "DD/MMMM/YYYY")
MsgBox DateAdd("d", CInt(TextBox2.Value), CDate(TextBox1.Text))
TextBox3.Text = Format(DateAdd("d", CInt(TextBox2.Value), CDate(TextBox1.Text)), "DD/MMMM/YYYY")
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Date pop-up window Roshan Hanief Word 0 04-23-2011 04:16 AM
Creating an Auto-Calc'd Date? Today+7 Days? SoCalTelephone Word 0 10-06-2010 10:27 AM
Creating a date box Julian Date windseaker Excel 1 02-14-2010 01:44 AM
new appointment date always reverts back to today's date msills Outlook 0 08-24-2007 08:57 AM
Creating a date box Imported message date change to today's date promark Outlook 1 12-23-2005 07:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft