how do I get a "Last serviced" to add 6 weeks in "Next service" i.

C

Comdiver

I can't get my data (next serv) to update from the (last serviced) date If my
(maint) field is Yes. Any help on the argument would be helpful.
 
A

Allen Browne

If a service is *always* exactly 6 weeks from the last service, you can do
this with a subquery or DMax() expression that gets the maximum service date
for the thing and uses DateAdd() to add 5 weeks.

If you need to be able to modify the value some it's not always 6 weeks, or
if some things need servicing more/less often, then you could use the
AfterUpdate and AfterDelConfirm events of the form where these entries are
made to execute an Append or Update query to add the new "service due"
record.
 
J

John Vinson

I can't get my data (next serv) to update from the (last serviced) date If my
(maint) field is Yes. Any help on the argument would be helpful.

The Next Service field probably *should not exist*, since it can be
calculated on demand any time:

NextService: IIF([Maint], DateAdd("ww", 6, [Last Serviced]), Null)

If you wish to store it (perhaps the 6 weeks is a suggested default
which you may want to edit), you can use the same expression in an
Update query or in the BeforeUpdate event of the Form you're using to
enter the data.

John W. Vinson[MVP]
 
Top