Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Microsoft Access Formula Help

Feb 4, 2007 11:49AM PST

I am attempting to create a formula in a Microsoft Access (2000)database I have created and don't know which formula to use or how to use it.

Basically I would like a date field I have created to update another date field by 14 days but only if a tick box is checked. If the tick box is not checked, I would like the 2nd date field to be 00/00/00.

That would create interaction between 3 fields.

I would also like the 2nd date field to revert from the updated 14 days to 00/00/00 if the tick box is later unchecked.

I can get the 2nd field to update with DATEADD but can't get it to interact with the tick box. All forms in that date field are automatically updated by 14 days regardless of whether the tick box is checked or not.

What would a formula such as this look like?

Thank you.
Lyn

Discussion is locked

- Collapse -
Re: Access formula
Feb 4, 2007 5:13PM PST

Lyn,

In cases like this, I write VBA-code that's coupled to the OnClick-event of the OK-button on the form I created for the user to fill in the data. All calculations are done when the record is stored after the user clicks OK.

It won't harm at all to add equivalent code to the AfterChange-event of both the checkbox and the first date, so that values (and the screen display, and the record to be saved) is updated immediately when these fields are changed. That might be more user friendly.

Hope this helps.


Kees

- Collapse -
Thanks
Feb 6, 2007 6:04AM PST

Thanks for your response Kees. Your answer has told me where to look to get help to do this.

Much appreciated.

Lyn