Calculate Null Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to calculate two date fields minus each other. If one of the
date field is blank, I want to be able to add a date. This is what I have so
far. Any ideas?

Nights: Nz([CheckOutDate],Nz([Enter Date for Blank
Records],Date()))-[CheckInDate]
 
I am trying to calculate two date fields minus each other. If one of the
date field is blank, I want to be able to add a date. This is what I have so
far. Any ideas?

Nights: Nz([CheckOutDate],Nz([Enter Date for Blank
Records],Date()))-[CheckInDate]

Use the DateDiff() function to calculate the difference (in days, years,
seconds, or any time interval in between):

Nights: DateDiff("d", [CheckInDate], NZ([CheckOutDate], NZ([Enter date for
blank records], Date())))

This will start with the checkin date, and end with the checkout date if it
exists; if it doesn't, with the user's response to the prompt; and if they
leave that blank, with today's date. Is that what you want?

John W. Vinson [MVP]
 
or any time interval in between

So, what is the DateDiff argument for Fortnight? :)

(Sorry John, sometimes I just can't control my brain)
--
Dave Hargis, Microsoft Access MVP


John W. Vinson said:
I am trying to calculate two date fields minus each other. If one of the
date field is blank, I want to be able to add a date. This is what I have so
far. Any ideas?

Nights: Nz([CheckOutDate],Nz([Enter Date for Blank
Records],Date()))-[CheckInDate]

Use the DateDiff() function to calculate the difference (in days, years,
seconds, or any time interval in between):

Nights: DateDiff("d", [CheckInDate], NZ([CheckOutDate], NZ([Enter date for
blank records], Date())))

This will start with the checkin date, and end with the checkout date if it
exists; if it doesn't, with the user's response to the prompt; and if they
leave that blank, with today's date. Is that what you want?

John W. Vinson [MVP]
 
or any time interval in between

So, what is the DateDiff argument for Fortnight? :)

(Sorry John, sometimes I just can't control my brain)

<g> I was thinking about nanoseconds and eons after I posted...

John W. Vinson [MVP]
 
Off the top of my head and without any desk checking or testing

(DateDiff("d",Date1, Date2) +1) \14

Someone else can work out how to calculate the number of moons - lunar
periods not the activity puerile activity of displaying ones buttocks

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Thank You, this is perfect!
--
Rose


John W. Vinson said:
I am trying to calculate two date fields minus each other. If one of the
date field is blank, I want to be able to add a date. This is what I have so
far. Any ideas?

Nights: Nz([CheckOutDate],Nz([Enter Date for Blank
Records],Date()))-[CheckInDate]

Use the DateDiff() function to calculate the difference (in days, years,
seconds, or any time interval in between):

Nights: DateDiff("d", [CheckInDate], NZ([CheckOutDate], NZ([Enter date for
blank records], Date())))

This will start with the checkin date, and end with the checkout date if it
exists; if it doesn't, with the user's response to the prompt; and if they
leave that blank, with today's date. Is that what you want?

John W. Vinson [MVP]
 
Back
Top