473,404 Members | 2,213 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,404 software developers and data experts.

Autofill date field in a form and add a period of time to the date

Good morning all,

I am designing a database to administer courses. When setting up a course a renewal date needs to be set, this is based on the end date of the course and how long the certificate is valid for.

The period of validity varies from course to course and this information is stored in the tblCourseInformation. This is stored as an integer.

The course end date and renewal are stored in the tblCourseAdmin.

The for I have designed incorporates fields from 3 tables and the data populates automatically when a course is selected from a combobox.

I've tried using the DateAdd funtion in the after_update section in properties (and in the defult value). Neither of these have worked for me {Example: =DateAdd([yyyy],[Renewal Period (Years)],[End Date])}.

I've also tried manipulating an excel formula in the code builder, whith no joy (probably due to a complete lack of coding skills).

Any help will be gratefully recieved.

Cheers
Gareth
Feb 11 '20 #1
2 1962
twinnyfo
3,653 Expert Mod 2GB
Gareth,

Welcome to Bytes!

The Format for your DateAdd() Function should be exactly as follows:

Expand|Select|Wrap|Line Numbers
  1. =DateAdd("yyyy", [Renewal Period (Years)], [End Date])
I am also assuming that the items in square brackets are Field Names? As long as Renewal Period is an integer and End Date is a valid date, this formula should work.

Please let us know how this resolves your issue.

Hope this hepps!
Feb 11 '20 #2
NeoPa
32,556 Expert Mod 16PB
Hi Gareth.

If you look up in Help for the DateAdd() function you'll see that the first parameter (Interval) is a string value. A string value is delimited by double-quotes (") in VBA and single-quotes (') in SQL and The Expression Service.

When a reference is made to text within square brackets as you have it then Access (whichever part you're using) will try to reference a Field, then a Control. If it doesn't find a valid match for either it will use the text between the brackets to prompt the user on the screen for a value. While this may be the desired approach for [End Date] it's unlikely to be so for [Renewal Period (Years)] and is almost certainly wrong for [yyyy].

I hope that makes the problem clear.
Feb 12 '20 #3

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

Similar topics

36
by: Martin Herrman | last post by:
Dear scripters, I am working on a HTML form in which a date must be entered of the form 'dd-mm-yyyy'. Now I'm looking for a script that, when the user switches to another form field, changes...
3
by: Dustin Wilson | last post by:
I have a problem with the following line of code. rstOutput! = FormatDateTime("January 1, 2004", vbLongDate) When I run this on my computer at home it runs without problem but when I run it at...
1
by: Dave Mann | last post by:
Right i have tried but failed! I have a Form and a subform Fields in Sub form are:- Planned - Checkbox Unplanned - Checkbox Maint Type - Dropdown selection Date Done Description
1
by: viki.sanjeeva | last post by:
Hi, There is a date field in JSP form where user will enter date in dd-mm-yyyy format. Now before saving into DB2, I want to validate the date format against dd-mm-yyyy format and then save into...
2
by: Igor | last post by:
Can someone tell me sql query for filtering date field for current day, not last 24hours but from 00:00 to current time?
3
by: Finn Stampe Mikkelsen | last post by:
Hi I have defined a table in my database, with 2 date-fields. I have set a default value to DBNull. I have integrated a nullable datetimepicker control to my project and set the apropriate...
1
by: tomzji | last post by:
I am using Sql server 2005. I have one table named 'tblJob'. This table have two fields say 'Staus' and 'ExpiryDate'. when 'Expirydate' come to less than current date, i want to upadte 'Status'...
22
by: tonialbrown | last post by:
I have an Sql update statement that I am using that updates the data from a record chosen by the user from a list box lstDelFrom. This is working for all the text fields & updates fine. Once I add...
9
by: yappy77 | last post by:
I want my "requalify date" to auto populate to the beginning of the month in the following year when my "liability date" gets entered/changed. Example: Liablity date = 11/15/2010; 7/31/2011 ...
1
by: mustaqalifj | last post by:
I enter my expense records AFTER a month is gone. What I want to be able to do is once I enter a date the next record's date auto fills next day's date. For eg. I entered first date as Dec 1, 2016,...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.