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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a formulae

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I am running a query on a form which has the following fields.

Contract No.
Required Delivery Date
Total Contract Hours

What I need to do is to run a formula that takes a 'start date' and adds the total to it in order to get the next possible start date for the next job. For example:

Contract No - 808
Start Date - 28/12/02
Total Contract Hours - 25

This would mean that the next record should read:

Contract No - 809
Start Date - 29/12/02
Total Contract Hours - 3

And so on...

If the next records start date is less after the 'Required Delivery Date' then that rows text should show red.

I need to start with a fixed start date that ia always the same and the rest of the start dates should then be calculated by some formula.
I do not have a field called 'Start Date' in my table and am stuck as to the best way around this problem. Could anyone suggest how I could do this?

Cheers,

Woody.
 
Woody, I don't think I'm really clear on what you are up to. I think I understand that you want to calculate some field values for the next record, but the term query has me confused.

If you need a formula to add hours to dates, then I would use somthing like this:

var

totHrs number
startDate date
nextDate date

endvar

if totHrs >= 24
then nextDate = startDate + int(totHrs/24)
else nextDate = startDate
endif

This is very basic and does not take into account a specific start time. If the business is running an 8 hour day, change the 24 to 8.


Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top