Dowsey1977
12-08-2005, 05:35 AM
Hi,
I'm using the below code to add the value in TextBox3 to the value in TextBox10, and put it in TextBox12.
TextBox3 is a date and TextBox10 is a number, in this instance a 1.
This works fine, but I want to make a slight change so that it adds exactly 1 day the date in TB10, i.e. if TB10 is Now(), so it shows the date and time, I want TB12 to show tomorrows date, with the same time, so exactly 24 hours on.
Any ideas if this is possible? :dunno
TextBox3.Value = Format(Now, "d-mmmm-yy h:mm")
TextBox10.Value = 1
TextBox12.Value = ""
newDate = Format(DateValue(TextBox3.Value) + TextBox10.Value, "d-mmmm-yy")
If Weekday(newDate, vbUseSystemDayOfWeek) = 6 Then
newDate1 = Format(DateValue(newDate) + 2, "d-mmmm-yy h:mm")
Else
If Weekday(newDate, vbUseSystemDayOfWeek) = 7 Then
newDate1 = Format(DateValue(newDate) + 1, "d-mmmm-yy h:mm")
Else
newDate1 = Format(DateValue(newDate), "d-mmmm-yy h:mm")
End If
End If
If TextBox12.Value = "" Then
TextBox12.Value = Format(DateValue(newDate1), "d-mmmm-yy h:mm")
End If
I'm using the below code to add the value in TextBox3 to the value in TextBox10, and put it in TextBox12.
TextBox3 is a date and TextBox10 is a number, in this instance a 1.
This works fine, but I want to make a slight change so that it adds exactly 1 day the date in TB10, i.e. if TB10 is Now(), so it shows the date and time, I want TB12 to show tomorrows date, with the same time, so exactly 24 hours on.
Any ideas if this is possible? :dunno
TextBox3.Value = Format(Now, "d-mmmm-yy h:mm")
TextBox10.Value = 1
TextBox12.Value = ""
newDate = Format(DateValue(TextBox3.Value) + TextBox10.Value, "d-mmmm-yy")
If Weekday(newDate, vbUseSystemDayOfWeek) = 6 Then
newDate1 = Format(DateValue(newDate) + 2, "d-mmmm-yy h:mm")
Else
If Weekday(newDate, vbUseSystemDayOfWeek) = 7 Then
newDate1 = Format(DateValue(newDate) + 1, "d-mmmm-yy h:mm")
Else
newDate1 = Format(DateValue(newDate), "d-mmmm-yy h:mm")
End If
End If
If TextBox12.Value = "" Then
TextBox12.Value = Format(DateValue(newDate1), "d-mmmm-yy h:mm")
End If