Calculate Null 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]
 
J

John W. Vinson

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]
 
G

Guest

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]
 
J

John W. Vinson

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]
 
J

John Spencer

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
'====================================================
 
G

Guest

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top