I need a function with Dates

J

Jimmy

Hello.
In a form we enter two dates. Hotel Check-In Date and Hotel Check-Out Date.
We need to have in a new field how many days he stayed in the hotel, a
simple number that will come from the abstraction. And it should be saved
somewhere in the querie for every record. Please step by step instruction if
possible since I am a newbie.
Thank you in advance
Jimmy
 
D

Duane Hookom

There should be no reason to "save" the number of days since you can always
calculate it with an expression like:
DaysStay: [CheckOutDate]-[CheckInDate]
You can also use the DateDiff() function.
 
P

PC Datasheet

Jimmy,

I have a room reservations module that could be implemtented in your
database. You enter a date and all your rooms are graphically displayed on
the screen showing which rooms are occupied on tha date. You can click on
any reserved room to get all the details of the reservation and you can
click on an unreserved room to find out when that rom is next reserved.

If you are interested in having this module implemented in your Hotel
database, contact me at my email address below.
 
J

John Vinson

Hello.
In a form we enter two dates. Hotel Check-In Date and Hotel Check-Out Date.
We need to have in a new field how many days he stayed in the hotel, a
simple number that will come from the abstraction. And it should be saved
somewhere in the querie for every record. Please step by step instruction if
possible since I am a newbie.
Thank you in advance
Jimmy

Just calculate this dynamically as needed. Base a Query on your table;
in a vacant Field cell type

DaysStayed: DateDiff("d", [Hotel Check-In Date], [Hotel Check-Out
Date])

This field should NOT be stored anywhere since it can be recalculated
as needed.

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