473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Access 2013: Use DateAdd to calculate based on button click

Creating a database to track training. I have a form in which an original certification date is entered. From that date, I need to add 1, 2, or 3 years to determine the due date for re-certification (a separate field) based on the button that is clicked ("1 year", "2 year", or "3 Year".)
Sep 13 '18 #1

✓ answered by Seth Schrock

If you are doing it in the property sheet, then you need to remove everything to the left of the equals sign. If you are wanting to do it in the button's OnClick event, then you will need to do something like the following:
Expand|Select|Wrap|Line Numbers
  1. Me.ControlName= DateAdd ("yyyy",1,[Certification_Date]) 

6 1291
Seth Schrock
2,965 Expert 2GB
Here is a link to the description of the DateAdd() Function.
Sep 13 '18 #2
thanks for the reply Seth. I have that info, but it doesn't work. Not sure if I am putting it in the right location or not. I tried putting it in the "On click"for the button, but I get an error about it being a macro:
Expand|Select|Wrap|Line Numbers
  1. [Re-Certification_Date]= DateAdd ("yyyy",1,[Certification_Date])
Sep 13 '18 #3
Seth Schrock
2,965 Expert 2GB
Are you doing this in code or in a macro? I would highly recommend using code and not a macro.

Also, please provide the exact error message along with the number if provided.
Sep 13 '18 #4
I had done this in the "Property sheet". I used Access on a regular basis, a hundred years ago, but have been away from it for so long I think I have forgotten everything, lol.

The Exact Error is:
Microsoft Access cannot find the object '[Re-Certification_Date]= DateAdd ("yyyy",1,[Certification_Date]).'

If '[Re-Certification_Date]= DateAdd ("yyyy",1,[Certification_Date])' is a new macro or macro group, make sure you have saved it and that you have typed its name correctly.


There is no number associated with the error.

Thanks again!
Sep 13 '18 #5
Seth Schrock
2,965 Expert 2GB
If you are doing it in the property sheet, then you need to remove everything to the left of the equals sign. If you are wanting to do it in the button's OnClick event, then you will need to do something like the following:
Expand|Select|Wrap|Line Numbers
  1. Me.ControlName= DateAdd ("yyyy",1,[Certification_Date]) 
Sep 13 '18 #6
You're Awesome Seth! I had forgotten all about "Me."

I just did it in the "Event Procedure" for the Button "OnClick" event and voila!!
Sep 13 '18 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: GKJR | last post by:
I have been using Access 2013 (in Office 365) with Windows 8.1 for about a month and a half now. I was a little reluctant to switch from 2010 on Windows 7, but I figured I should try stay ahead of...
1
by: msilva100 | last post by:
Is it possible to split a Runtime MS Access 2013 database? I am on a Windows 7 server. I have one license of MS Access 2013. But I would like distribute this application to 5 client workstations. ...
4
by: jimatqsi | last post by:
A form I created that uses tabs seems to work fine on my development machine (Access 2007, fully patched). But two users that have Access 2013 runtime installed cannot see the tabs. They can see and...
7
by: jalbright1957 | last post by:
We have Office365 / Sharepoint online / Exchange online in our organization. I am the only one with the E3 subscription which gives me Access. I have a database that needs to be made available to...
1
by: tallen | last post by:
ADezii and zmbd, I have one other question. There seems to be some other code which possibly should reflect the new DAO code. the following does not allow forms to open any longer and files were...
1
by: imagecko | last post by:
I have a button on a form. in the on click I am calling a user defined function. If there are no letters it appears like this: =showsystemdetails(12345) if there are letters it autodefaults to...
1
by: spdragoo | last post by:
OK, so I'm helping my wife out & trying to develop an Access 2013 database that will be used on Windows PCs. They're setting up a special tutoring lab at her college where remedial students can take...
1
by: Penuel | last post by:
l want to display the map from ArcGIS by click the button in my interface l design from access 2013. Is it possible if it is l need your help plz
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.