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
-
Trump signs Take It Down Act
by
Alex5723
1 hour, 19 minutes ago -
Do you have a maintenance window?
by
Susan Bradley
1 hour, 44 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 hours, 52 minutes ago -
Success Knows No End in the World of Online Slots (Awaiting moderation)
by
isobelhartmann1
3 hours, 2 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
4 hours, 38 minutes ago -
Help with WD usb driver on Windows 11
by
Tex265
9 hours, 48 minutes ago -
hibernate activation
by
e_belmont
13 hours, 33 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
17 hours, 21 minutes ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
20 hours, 26 minutes ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
20 hours, 28 minutes ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
37 minutes ago -
Out of band for Windows 10
by
Susan Bradley
1 day, 1 hour ago -
Giving UniGetUi a test run.
by
RetiredGeek
1 day, 8 hours ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 15 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
1 hour, 48 minutes ago -
Auto Time Zone Adjustment
by
wadeer
1 day, 20 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
1 day, 17 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
22 hours, 30 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
10 hours, 55 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
17 hours, 20 minutes ago -
Apps included with macOS
by
Will Fastie
15 hours, 11 minutes ago -
Xfinity home internet
by
MrJimPhelps
11 hours, 59 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 day, 13 hours ago -
Debian 12.11 released
by
Alex5723
2 days, 17 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
2 days, 21 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 days ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
4 hours, 10 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
3 days, 13 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
3 days, 4 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 2 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.