Adding and Linking Dates to Another Field

T

TomP

I have two (2) field in my form. Field 1 is called "Date" and field 2 is
called "Due Date". I would like the "Due Date" field to automatically add 90
days from the "Date" field and have that updated in the "Due Date" field. I
tried using the DateAdd function in the control box and also the default
portion of the field.

Any help would be appreciated.

Thank you,

TomP
 
K

Klatuu

For staters, change the name of the field you call Date. Date is an Access
reserved word. Even when enclosing the name in brackets [Date], you can have
problems.
Where you do it depends on when you do it. My suggestion would be to use
the After Update event of the control on your form to which the Date field is
bound.

Me.txtDueDate = DateAdd("d", 90, Me.txtDate)
 
T

TomP

Thank you for the quick response!

I opened the "duedate" field and added the statement as typed and nothing
happened...:-(

I entered a date in the "date" field and moved to the next and nothing is
shown in the "duedate" field. Ideally, it would be nice if the "duedate"
would automatically reflect the 90 day deadline. The due date would not be
visible to the form and be used in the reports.

Tom

Klatuu said:
For staters, change the name of the field you call Date. Date is an Access
reserved word. Even when enclosing the name in brackets [Date], you can have
problems.
Where you do it depends on when you do it. My suggestion would be to use
the After Update event of the control on your form to which the Date field is
bound.

Me.txtDueDate = DateAdd("d", 90, Me.txtDate)
--
Dave Hargis, Microsoft Access MVP


TomP said:
I have two (2) field in my form. Field 1 is called "Date" and field 2 is
called "Due Date". I would like the "Due Date" field to automatically add 90
days from the "Date" field and have that updated in the "Due Date" field. I
tried using the DateAdd function in the control box and also the default
portion of the field.

Any help would be appreciated.

Thank you,

TomP
 
K

Klatuu

It sounds like you did not put the code in the proper place. If you entered
a value in the date field and the code is in the After Update event of the
date field, then the value should show up in the due date field.
--
Dave Hargis, Microsoft Access MVP


TomP said:
Thank you for the quick response!

I opened the "duedate" field and added the statement as typed and nothing
happened...:-(

I entered a date in the "date" field and moved to the next and nothing is
shown in the "duedate" field. Ideally, it would be nice if the "duedate"
would automatically reflect the 90 day deadline. The due date would not be
visible to the form and be used in the reports.

Tom

Klatuu said:
For staters, change the name of the field you call Date. Date is an Access
reserved word. Even when enclosing the name in brackets [Date], you can have
problems.
Where you do it depends on when you do it. My suggestion would be to use
the After Update event of the control on your form to which the Date field is
bound.

Me.txtDueDate = DateAdd("d", 90, Me.txtDate)
--
Dave Hargis, Microsoft Access MVP


TomP said:
I have two (2) field in my form. Field 1 is called "Date" and field 2 is
called "Due Date". I would like the "Due Date" field to automatically add 90
days from the "Date" field and have that updated in the "Due Date" field. I
tried using the DateAdd function in the control box and also the default
portion of the field.

Any help would be appreciated.

Thank you,

TomP
 
T

TomP

It works now. Thank you for your help!

Merry Christmas!

Klatuu said:
It sounds like you did not put the code in the proper place. If you entered
a value in the date field and the code is in the After Update event of the
date field, then the value should show up in the due date field.
--
Dave Hargis, Microsoft Access MVP


TomP said:
Thank you for the quick response!

I opened the "duedate" field and added the statement as typed and nothing
happened...:-(

I entered a date in the "date" field and moved to the next and nothing is
shown in the "duedate" field. Ideally, it would be nice if the "duedate"
would automatically reflect the 90 day deadline. The due date would not be
visible to the form and be used in the reports.

Tom

Klatuu said:
For staters, change the name of the field you call Date. Date is an Access
reserved word. Even when enclosing the name in brackets [Date], you can have
problems.
Where you do it depends on when you do it. My suggestion would be to use
the After Update event of the control on your form to which the Date field is
bound.

Me.txtDueDate = DateAdd("d", 90, Me.txtDate)
--
Dave Hargis, Microsoft Access MVP


:

I have two (2) field in my form. Field 1 is called "Date" and field 2 is
called "Due Date". I would like the "Due Date" field to automatically add 90
days from the "Date" field and have that updated in the "Due Date" field. I
tried using the DateAdd function in the control box and also the default
portion of the field.

Any help would be appreciated.

Thank you,

TomP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top