Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding days to dates

Status
Not open for further replies.

rkatyal

IS-IT--Management
Jun 21, 2003
116
US
I have a Field called ShipDate that is of type date

Then I have a field called Cont_Exp_Date, which is really

ShipDate + 1095days

how can I put that formula in access.

I am trying to bring one of my spreadsheets into Access from Excel.

Thanks for help
 
What about simply this ?
ShipDate + 1095

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I put that under Default Value and I get a Type Mismatch Error?

Please advise
 
under Default Value of WHAT ?
Any chance you could elaborate on what you want to do ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok.

I am in the design view of my table.

I have a field called ShipDate = Data type Date
I have a field called Contract_Exp_Date = Data Type Date

When someone enters the Ship Date into the table, I want the contract_exp_date to get calculated automatically based on the formula ShipDate + 1095 days.

I am trying to figure out how to do that.

I am a newbie with database so this may be somewhat elementary question.

Just that I had this in my spreadsheet and now I have been asked to bring all the data into an Access database.

thanks for your help
 
Why storing derived/calculated values ?
Have a look here:

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry if I am being rude, but if I wanted to read the book, I would'nt have posted the query here.

 
rkatyal said:
I am a newbie with database
So keep playing with excel if you don't want to read the elementary basics of database design.
 
I needed the answer to my query if you knew it you could have posted it.

I will decide and be the judge as to what I want to play with.

Thanks for the help
 
You can't set a default value in a table that references data. But, that's ok since you shouldn't be entering data directly into tables anyhow. Data should be entered into forms where you can set default values. I would use the after update event of a control to set the value of another.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
and the link you were provided isn't a book, it is a paper that explains the basics of database design. One of which is, you don't store calculated values. If you need Cont_Exp_Date you do this in a query:

SELECT ShipDate + 1095 As Cont_Exp_Date FROM SomeTableName


PHV was offering you the opportunity to inform yourself of a little bit about databases BEFORE you start to build one. This is a bit selfish of him, because in when your database doesn't work correctly because it wasn't designed correctly, you will be returning to some forum asking for additional help. If you do it correctly now, it makes it easier on US in the future to give you additional assitance.


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top