Working with date fields in a form

J

Janes N

I have three fields in a form. The first field is the first service date, the
second field is the amount of time in days until the service should be
scheduled again, the third field is the next service date.
What I would like to do is add the days in the second field to the date in
the first field and populate the third field with a projected date.
Example: Field 1: 01/01/10
Field 2: 90 (days)
Field 3: 04/01/10 (automaticaly calculated)
Can this be done?
Thanks
James
 
J

Jack Leach

Take a look at the DateAdd() function in VBA help. One of your fields will
be unbound... it will be the second or third field, depending on which data
you want to store (you will either store the interval, or the next service
date, but not both). The unbound field will be calculated using the DateAdd
function.


hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
J

John W. Vinson

I have three fields in a form. The first field is the first service date, the
second field is the amount of time in days until the service should be
scheduled again, the third field is the next service date.
What I would like to do is add the days in the second field to the date in
the first field and populate the third field with a projected date.
Example: Field 1: 01/01/10
Field 2: 90 (days)
Field 3: 04/01/10 (automaticaly calculated)
Can this be done?
Thanks
James

Field3 should simply NOT EXIST in your table, since its value can be derived
from the other two fields.

Instead, use a Form with a calculated field. Set the Control Source of the
textbox for the next service date to

=DateAdd("d", [Field2], [Field1])

to dynamically add the (integer) number of days to the date.
 

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