hcl-bot
September 12, 2003, 2:54pm
1
(I’m trying to calculate the number of days from start to finish of the project)
I have 3 fields
ProjectStartDate (Value @Today )
ProjectCompletionDate (Valuel @Today )
NbrConstructionDays ( defined as Number field)
I have the following code on my QuerySave event
Dim NbrConstructionDaysHold As Variant
NbrConstructionDaysHold = (ProjectCompletionDate - ProjectStartDate )
doc.NbrConstructionDays = NbrConstructionDaysHold
The field value of NbrConstructionDays always caluclates the number 0
WHAT AM I DOING WRONG? THANKS SO MUCH FOR YOUR HELP.
hcl-bot
September 12, 2003, 3:32pm
2
Subject: Perhaps this?
Dim NbrConstructionDaysHold As VariantNbrConstructionDaysHold = (doc.ProjectCompletionDate(0) - doc.ProjectStartDate(0)) ’ value is in seconds
doc.NbrConstructionDays = NbrConstructionDaysHold / 60 / 60 / 24 ’ now value is in days
hcl-bot
September 15, 2003, 7:12am
3
Subject: RE: Perhaps this?
Thanks for your help. It was the doc. and (0) that fixed it.
Thanks again.
hcl-bot
September 12, 2003, 3:23pm
4
Subject: Number of days
Hmmm. I’m a bit confused. Are the fields on the form computed when composed? At first glance, it would look like you’re doing:@Today - @Today and a number minus itself is always going to be zero.
One of the things you might want to do first is to set “Option Explicit”. That forces you to define and declare variables.
Again, it’s hard to see what you’re doing, but shouldn’t your code be something like this (given your form):
NbrConstructionDaysHold = (doc.ProjectCompletionDate(0) - doc.ProjectStartDate(0))
?
Just wondering.
I think for this you might want to look at the reference for the NotesDateTime class and particularly the method “TimeDifference”
Good luck