473,387 Members | 1,882 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,387 software developers and data experts.

How do you calculate a date on a form?

Hello,

I've designed a form where I'd like users to be able to enter a date into field number one. When they do that, field number two will be populated with a date that is 27 years from the date they entered. How do I go about setting this up?

Will the data in field number two be saved to the corresponding field the table the form is associated with?

Thanks.
Barry
Jul 30 '10 #1
1 1840
missinglinq
3,532 Expert 2GB
Answering the second question first, absolutely not! Most calculated values, and certainly this one, should not be stored in the underlying table but rather simply re-calculated when needed, such as in another form or report. So, with Field2 being Unbound:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Field1_AfterUpdate()
  2.  Me.Field2 = DateAdd("yyyy", 27, Me.Field1)
  3. End Sub
  4.  
  5. Private Sub Form_Current()
  6.  Me.Field2 = DateAdd("yyyy", 27, Me.Field1)
  7. End Sub
Linq ;0)>
Jul 30 '10 #2

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

Similar topics

2
by: wireless | last post by:
In our database is a decimal field with format YYMMDDhhmmss.9999999999 where the 9s are random digits. I'm trying to strip off just the YYMMDD and put it in date form. So far I came up with:...
2
by: Rustan | last post by:
Hi Im using GregorianCalendar to find out the current years week numbers. When the user chooses a week number in a dropdown i want to show that week in a table with the corresponding dates. For...
4
by: Lisa Jones | last post by:
Hi Can someone tell me How do you get selected date form MonthCalendar control Thanks so muc Lisa
1
by: jbsfe | last post by:
I have a table used to enter the last date a project was updated. When updating via a form, I need to compare the new date against the last date in the record. If the difference is greater than...
4
by: John Devlon | last post by:
Hello everyone... Does anyone know if there is easy way to calculate a certain day in the future ? For example: I would like to calculate when the date is 15 days from today .... I've...
3
by: Golan | last post by:
Hi all, I need to write a code which gets a date (in format 'YYYYMMDDhh24MISS') and number of seconds (X), and returns the date (again in format 'YYYYMMDDHH24MISS') that is X seconds prior to...
7
by: mell | last post by:
I am the new programmer. I have encounter with the problem to calculate the date auto beacuse I has been assign to develop library system for my final project...How I can automatik calculte the date...
4
by: lenygold via DBMonster.com | last post by:
I found this example in MYSQL: create table events ( id integer not null primary key , datetime_start datetime not null , datetime_end datetime not null ); insert into events values ( 1,...
1
by: aneinander | last post by:
I'm beginner and getting following error message, please help. The table contains transaction date, account number, branch, etc. And need to show previous transaction date or next transaction date...
1
OuTCasT
by: OuTCasT | last post by:
Hi All I need to add 3 months to a date so i can calculate when a clients email bundle is out dated. so for instance the client registed his bundle on 2009/09/01. I need to be able to add 3...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.