How to enter date automagically from calulated yes/no box?

nickbarnes

New Member
Joined
Aug 2, 2011
Messages
5
Hi,

Im an Access beginner and I really need some help setting a date field based on a whether a calculated tick box is true or false within a web database which will be stored on SharePoint.

I have 4 yes/no fields for users to tick when they have finished a part of a job:
AddressingComplete
EstimateComplete
PurchaseOrderComplete
TelemetryComplete
Once all of these are ticked, a calculated yes/no field "TasksComplete" changes to True.

Is it possible for me to have the field "ExchangeCompleteDate" automatically enter Date() when the "ExchangeComplete" box gets ticked?

Hopefully you get the jist of what Im trying to do!

Thanks for your help guys!

Nick
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I am not extremely knowledgeable about Sharepoint, but essentially, this is a calculation that should be done on the front end and not the back end anyways. Also, you say that a calculated field "TasksComplete" is Yes/No depending on the other 4 fields, correct? If so, are you storing this calculated value, because if you are you are really just storing redundant information and any queries based on whether that field of "TasksComplete" is true or not can be run just as easily checking all four of the fields that it depends on.

But anyways, I digress. Here is something that should help:
Code:
Private Sub myCheckBox_Click()
If Me.myCheckBox.Value = True Then
    Me.myDateField.Value = Date
End If
Me.Dirty = False
End Sub
 
Upvote 0
Thanks for your help, that worked perfectly!

How could I modify it so that if the box is unticked then the date also disappears?

Also, I get the first part of the code but what exactly does "Me.Dirty=False" do? Sorry Im an Access noob :stickouttounge:

Thanks again!
 
Upvote 0
How could I modify it so that if the box is unticked then the date also disappears?
Lol, I was thinking about including this but decided against it! A simple "Else" statement would fix that. Like this:
Code:
Private Sub myCheckBox_Click()
If Me.myCheckBox.Value = True Then
    Me.myDateField.Value = Date
Else
    Me.myDateField.Value = ""
End If
Me.Dirty = False
End Sub

As far as the Me.Dirty = False, "Dirty" means that the info loaded into the form has not been saved. Setting this property to false forces the save. Sometimes I come across code that executes and does something similar to what you are doing, but I also have other pieces of code taking place after it. This insures that the data is saved before continuing on with any of the other code.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top