Access Date Field default Value

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I have two date fields in my table. One for when a Task was Planned to happen and one field to capture when the task actually happened.


WBS_Release_Date_Planned
WBS_Release_Date_Actual


in the Default Value for WBS_Release_Date_Actual I put:

=[WBS_Release_Date_Planned]

But it doesn't like that. How do I get the field value for WBS_Release_Date_Actual default to the WBS_Release_Date_Planned? Note that I want the user to be able to change the WBS_Release_Date_Actual at some point (if it doesn't actually happen on the original planned date.

Do I do this in the table, in a query....? What's the best way?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I don't believe you are allowed to put formulas in the default value for a field, only hard-coded values.

How is this data coming in? If it is being entered manually, you can do that with VBA code on the creation of a new record. You would do this in an entry form, with VBA code behind it (users should NEVER be accessing the tables directly, it should all be form driven).

If this is data that you are importing, you can run an Update Macro to update the values you just added.
 
Upvote 0
Thanks Joe. Its being done on a Form. So basically you are saying use Code. When the User enters a Planned date, use an Even that stores that date over in the Actual date.

THANKS!
 
Upvote 0
Each field on your form has an "AfterUpdate" event attached to it. So, you could add the VBA code in the "AfterUpdate" event of the "Planned Date" field.
You may want to check the value of "Actual Date" in that code first (if you do not want to overwrite it if it already has a date in it).
 
Upvote 0
But it doesn't like that.
That doesn't help much. Means you got an error because you're trying to use an expression in a bound field?
You probably are on the right track, but if I guessed the design, now you know why it was a problem.

Correct on the table fields, I think. There are only 2 functions I can think of at the moment that are allowed in table fields: Now and Date. You probably already know that calculated table fields are not a good idea. ;)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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