Add days

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have 2 text box fields (TX_Start_Date & TX_End_Date) within a form in
short date format. Thes boxes are utilised by a procedure to enter info into
a table.

Question is how do i make the default value of the TX_End_Date text box to
be 5 days after the value that gets entered in the TX_Start_Date text box
when the user is filling out form.

I have tried ([TX_Start_Date].adddays(5)) to no avail. in the default value
option.

Ive also just tried Expression Description
=DateAdd("d", +5, [TX_Start_Date]) in the on focus option with nothing
happening.

Thankyou
 
Use the AfterUpdate event of TX_Start_Date to set the value of TX_EndDate.
Use DateAdd().
 
Thanks Allen, Great to see an Aussie helping an Aussie !!!

Does the formula go in the after update event of start date or end date &
could you also give me some hints of the exact formula :)
Todd

Allen Browne said:
Use the AfterUpdate event of TX_Start_Date to set the value of TX_EndDate.
Use DateAdd().

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tango said:
Hi,
I have 2 text box fields (TX_Start_Date & TX_End_Date) within a form in
short date format. Thes boxes are utilised by a procedure to enter info
into
a table.

Question is how do i make the default value of the TX_End_Date text box to
be 5 days after the value that gets entered in the TX_Start_Date text box
when the user is filling out form.

I have tried ([TX_Start_Date].adddays(5)) to no avail. in the default
value
option.

Ive also just tried Expression Description
=DateAdd("d", +5, [TX_Start_Date]) in the on focus option with nothing
happening.

Thankyou
 
In form design view, set the AfterUpdate property of TX_Start_Date to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens a code window.

Between the "Private Sub..." and "End Sub" lines, enter:

Me.TX_End_Date = DateAdd("d", 5, Me.TX_Start_Date)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tango said:
Thanks Allen, Great to see an Aussie helping an Aussie !!!

Does the formula go in the after update event of start date or end date &
could you also give me some hints of the exact formula :)
Todd

Allen Browne said:
Use the AfterUpdate event of TX_Start_Date to set the value of
TX_EndDate.
Use DateAdd().


Tango said:
Hi,
I have 2 text box fields (TX_Start_Date & TX_End_Date) within a form in
short date format. Thes boxes are utilised by a procedure to enter info
into
a table.

Question is how do i make the default value of the TX_End_Date text box
to
be 5 days after the value that gets entered in the TX_Start_Date text
box
when the user is filling out form.

I have tried ([TX_Start_Date].adddays(5)) to no avail. in the default
value
option.

Ive also just tried Expression Description
=DateAdd("d", +5, [TX_Start_Date]) in the on focus option with nothing
happening.

Thankyou
 
Unreal, Thanks Again Allen

Allen Browne said:
In form design view, set the AfterUpdate property of TX_Start_Date to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens a code window.

Between the "Private Sub..." and "End Sub" lines, enter:

Me.TX_End_Date = DateAdd("d", 5, Me.TX_Start_Date)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tango said:
Thanks Allen, Great to see an Aussie helping an Aussie !!!

Does the formula go in the after update event of start date or end date &
could you also give me some hints of the exact formula :)
Todd

Allen Browne said:
Use the AfterUpdate event of TX_Start_Date to set the value of
TX_EndDate.
Use DateAdd().


Hi,
I have 2 text box fields (TX_Start_Date & TX_End_Date) within a form in
short date format. Thes boxes are utilised by a procedure to enter info
into
a table.

Question is how do i make the default value of the TX_End_Date text box
to
be 5 days after the value that gets entered in the TX_Start_Date text
box
when the user is filling out form.

I have tried ([TX_Start_Date].adddays(5)) to no avail. in the default
value
option.

Ive also just tried Expression Description
=DateAdd("d", +5, [TX_Start_Date]) in the on focus option with nothing
happening.

Thankyou
 
Back
Top