Coding to automatically enter date depending on another field result

Milnerm

New member
Local time
Today, 08:44
Joined
Jun 23, 2017
Messages
6
Hi

Hope someone can help me with this.

I've been asked to add some verification fields to one of the databases. I've tried different coding but not quite what I need.

I need to do the following:

1. Create a checkbox to confirm the record requires a review at a future date - DONE

2. Automatically enter the review due date based on - if the checkbox is checked the review due date = another field date plus 182 days....this is what I need help with please.

Do I enter a formula at the table level or in an event field on the form? What coding should I enter?

Thanks in advance for your help
 
Hello again Michelle!

You are on the right track as far as using an unbound form field rather than using a table field.

I would use the form's oncurrent event.

Code:
IF Me.chkBox = True And Me.ReviewDate <> "" Then
     Me.unBoundDateField = Me.ReviewDate + 182
End IF

I am shooting from the hip on this one and have not tested this code, but you can tweak it as needed. Hopefully this will get you pointed in the right direction!
 
Hi thank you...will try this on Monday when I'm back in the office
 
Unfortunately this didn't work....I need to enter code to do the following:

When a User checks a checkbox (6 Month Review Required), the Review Due Date should automatically populate based on the calculation Actual Corrective Action Date (date/time field) plus 182 days. If a 6 month review is not required then the Review Due Date should remain empty.

I've tried various coding now and am really stuck because although the coding I've entered is accepted the Review Due Date is remaining empty despite the checkbox being checked.

Can you advise the coding and at the Table level what type of field the Review Due Date should be.

Thanks.

Michelle
 
Which version of Access are you using?

Sent from my SM-J320FN using Tapatalk
 
I THINK 2013 has calculated fields. They behave like Excel which is one of the reasons I don't use them. I am on the road right now which is why I can't dedicate some quality time and suggesting them as a quick fix...

Sent from my SM-J320FN using Tapatalk
 
Hi

Thank you...you're right about the Calculated fields. I've been able to work with calculated fields before but this one has me stuck because I don't know enough about VBA coding being self-taught.

Michelle
 

Users who are viewing this thread

Back
Top Bottom