Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2007, 10:33 AM
Registered User
 
Join Date: Feb 2007
Location: London, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculation in access

Hi I have a database with a field called "Startdate" "endDate" and "noOfdays". what i wanted to do is add the field "startdate" and "NoOfdays" it to give me the end date. And i wanted to do that in table design view. Thanks

aalahi
 
Old February 26th, 2007, 08:38 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Do you want days only, or just workdays?

If days only, then do this on your data entry form on the Before Insert AND Before Update events:

Dim dtStart, dtEnd As Data
Dim iDays As Integer

dtStart = Me.StartDate
iDays = Me.noOfDays

dtEnd = DateAdd("d", iDays, dtStart)

Me.endDate = dtEnd

If you wanted to try this at the design level then you are on your own. You will need to try to work with the Default value expression builder, which I don't use much.

Did that help?

mmcdonal




Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help creating calculation in Access karen.houston Access 2 August 11th, 2006 06:45 AM
Access Workdays calculation doug.hall Access 1 April 26th, 2005 02:19 PM
Calculation Grantm Access 3 February 16th, 2004 10:14 AM
Field Calculation Upgrade to VBA from Access Basic Pavesa Access VBA 2 December 23rd, 2003 12:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.