View Full Version : Date field


geno
08-13-2000, 12:19 PM
I have 4 controls on a form. The first is hire date. The other 3 are 3 month reveiw, 6 month review and 1 year review. How can I have the last 3 controls default to what ever the hire date is plus 3 months, 6 months and the year.
Thanks

Rich@ITTC
08-13-2000, 12:37 PM
Hi Geno

You would not have these three other fields as this would break one of the Norms of Database design (quite which Norm - 1st, 2nd, 3rd is something I can never remember and is not all that relevant). Database normalisation within a relational database (which Access is) does not allow the storage of data that is entirely dependant on a calculation based on a field within that table.

In other words, you only need one field to store the first date (i.e. HireDate). You then create a query based on this table that draws upon the table (tblHire) and is called qryHire. Within qryHire you make three new columns (in design view) that are calculated fields - the first is called Hire+3: and takes the HireDate and adds 3 months.

Hire+3"colon"([HireDate]+91)

The next is named Hire+6 and adds 182 days.

Hire+6"colon"([HireDate]+182)


The last, a year from the actual date, is then calculated by adding 365 days.

Hire+12"colon"([HireDate]+365)

Hope that helps.

[This message has been edited by Rich@ITTC (edited 08-13-2000).]

[This message has been edited by Rich@ITTC (edited 08-13-2000).]

geno
08-13-2000, 01:09 PM
Thanks for your input. I thought that might be the case. I took your advice, but had to do it a bit differently than you suggested.
ie: 3 Month Review: DateAdd("d",90,[HireDate]). This was the only way I could get it to work. Another question for you though. I made the input mask equivilant to a short date: 00/00/00, but when I run the query, I get: 00/00/0000. Do you know how to keep it a 2 digit year?
Thanks again...

Richie
08-13-2000, 01:38 PM
Change the format in the query design grid, plus date add 90days isn't 3mnths surely you need DateAdd("m",3,[YourDate])?