I have a table that includes a Date field (I’ll call it Date_field_1 here just to simplify things). I have a second date field (in the same table) that I’ll call Date_field_2.
Date_field_1 already has data in it. I need Date_field_2 to automatically default to a value that is Date_field_1 plus 2 years. For instance, if Date_field_1 has a value of 2/15/05, I need Date_field_2 to automatically default to 2/15/07. How can I make this the default?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Default value of date field (Access 2003)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Default value of date field (Access 2003)
- This topic has 10 replies, 3 voices, and was last updated 16 years, 5 months ago.
AuthorTopicWSlconway
AskWoody LoungerDecember 2, 2008 at 7:21 am #455719Viewing 0 reply threadsAuthorReplies-
WSDJLansing
AskWoody Lounger -
WSlconway
AskWoody LoungerDecember 2, 2008 at 7:49 am #1135664Sorry to be difficult. I’m sure this is an easy issue for most of you, but I am not experienced in this particular area of Access. Where exactly are you inputting that? I am looking in the Properties information for Date_field_2, in the Default value field. Is there a way to program the Default value to be 2 years after the value in Date_field_1? Or do I have to do some sort of update query to populate Date_field_2? (I want to try to make this a default value rather than having the user periodically run an update query to populate Date_field_2 because I want to ensure that if there is a value in Date_field_1, there is always a value in Date_field_2. Does that make sense?
-
WSDJLansing
AskWoody Lounger -
WSlconway
AskWoody LoungerDecember 2, 2008 at 7:59 am #1135667Not necessarily. Most of the records already have data in Date_field_1. For future records, sometimes the user is typing directly into a table. Sometimes she is going to use a form. So the main thing I’m worried about is getting the new field that is currently blank (Date_field_2) populated automatically based on the value that is already in Date_field_1. There are already MANY records in the table, and all already have a date in Date_field_1. I need to have Date_field_2 automatically populated based on the value in Date_field_1, regardless of whether the data is already filled in or whether it will be added or updated in the future. Does that make sense? Thank you in advance for your patience! (I have more experience with Queries and Reports and not much experience with calculations in Access!)
-
WSjohnhutchison
AskWoody LoungerDecember 2, 2008 at 8:27 am #1135677If you let user type data directly into a table, there is no way to automatically fill one field with a calculation based on another field. As Don suggested, this requires you to use forms.
But if the second date is ALWAYS 2 years after the first, it should not be stored in the table at all. One of the general principles of Access is that you don’t store things that can be calculated..
The calculation can be performed in a query where you add the calculated field : Date_field_2 : DateAdd(“yyyy”, 2, [Date_field_1])
Anytime you want to see this second date, you look at (or have a form or report that uses) this query rather than the table.
-
WSlconway
AskWoody LoungerDecember 2, 2008 at 8:36 am #1135680Point well taken on not storing data that can be calculated. I will talk with the users further to see how they are going to USE that 2nd date field. I have seen one new report that needs to display that data. I can certainly modify the query or the report it is based on to do the calculation as you provided. My worry is that they will need to use it in a number of different queries and reports, which would require them to be able to understand and type in the calculation frequently when they need it. Based on the queries and reports they are already using with the data, I may be able to talk them out of having the 2nd field exist at all! If they must have the second field appear, I will most likely do the combination of an update query to update the current data, and then add something to their data entry form to ensure that NEW records will have the correct value in Date_field_2. Thanks everyone. I’ll do one more post after I meet with the user again to figure out what will work best in these circumstances.
-
WSjohnhutchison
AskWoody LoungerDecember 2, 2008 at 8:53 am #1135684If you create one query that contains the calculation, then you can base any further queries/reports on that first query. That way the calculated field is available, and no-one ever needs to redo the calculation.
You can base the data entry form on the query as well, so the second date will appear on the form as soon as the first date is entered.
-
WSlconway
AskWoody LoungerDecember 2, 2008 at 9:00 am #1135699Yes–I at least know that much, but I appreciate the idea because you could not assume I knew that about queries.
What I’m worried about are all of the existing queries that the users already have that now need to include this new piece of data. And they will all be creating their own queries and reports in the future. They may base them on OTHER queries rather than this query. I really can’t stop them from doing so. That’s why I was trying to make the new date field a whole separate field in the table. The users KNOW how to add another field to their queries. And they know how to create new reports. By making the second date field a separate field in the table, the users can easily USE it in everything they do without THEM having to understand how to add the calculation to each new query or report they create in the future. Make sense?
-
WSjohnhutchison
AskWoody Lounger -
WSDJLansing
AskWoody LoungerDecember 2, 2008 at 8:28 am #1135678If your entering directly into the table I know of now way to auto populate the second date. Someone else will have to help you there.
To update the all the fields regardless of what is in Date_Field_2 with a year that is two years greater than the date in Date_field_1 use the following query.
UPDATE YourTableName SET YourTableName .Date_field_2 = DateAdd(“yyyy”,2,[Date_field_1]);
In your data entry form go to the design mode and select your Date_field_1 textbox. Go to its properties (right click on it and select properties)
Select the Event tab and click the After Update and select Event Procedure. Then insert the code I gave above.
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Convert PowerPoint presentation to Impress
by
RetiredGeek
30 minutes ago -
Debian 12.11 released
by
Alex5723
5 hours, 14 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
8 hours, 55 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
6 hours, 25 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
5 hours, 23 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
1 day, 1 hour ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
16 hours, 15 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 4 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
20 hours, 46 minutes ago -
Some advice for managing my wireless internet gateway
by
LHiggins
4 hours, 19 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
22 hours, 43 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
1 day, 14 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day, 10 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
1 day ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
2 days, 3 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
11 hours, 54 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
32 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days, 6 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days, 6 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 day, 19 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 days, 14 hours ago -
0Patch, where to begin
by
cassel23
2 days, 8 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days, 4 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
2 days, 16 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
3 days, 12 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
3 days, 3 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
6 hours, 9 minutes ago -
Installer program can’t read my registry
by
Peobody
2 hours, 20 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
3 days, 1 hour ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
3 days, 9 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.