Date to Date Count

Matt79

New member
Local time
Today, 15:25
Joined
Nov 2, 2007
Messages
9
Hi,
I am trying to create a query using these fields:
[First Name:]
[Last Name:]
[Phone #:]
[Date of Arrival:]
[Date of Departure:]
[Days Spent Here:]

I would like to be able to enter the date of arrival and enter the date of departure and have it give me the number of days spent here based on 365 or 366 days.

Does anyone know how to do that?

Cheers,
Matt
 
Use the DateDiff function

DaysSpentHere: DateDiff("d",[Date of Arrival],[Date of Departure])
 
Use the DateDiff function

DaysSpentHere: DateDiff("d",[Date of Arrival],[Date of Departure])


I tried this:

DaysSpentHere: DateDiff("d",[Date of Arrival],[Date of Departure])

but it is not exactly what I am looking for.
When I put the "DaysSpentHere: DateDiff("d",[Date of Arrival],[Date of Departure])" in, the query in makes me enter the Date of Departure in a parmeter everytime I open the Query. Also it makes all the departure dates the same for every record.

Is it Possible to make it as I am typing a record it automatically comes up with the number of days after I type the Arrival and Departure dates in?

cheers,
Matt
 
The reason it is making you enter it is that you have to enter the actual name of the field in the DateDiff function and apparently Date of Departure is not the exact field name. I gave you what you had entered in the post and it all needed to be tweaked to your EXACT field names.
 
Changed the names of the fields to 1 and 2 to avoid spelling errors and it worked great. However, Sometimes in the query it will not let me enter a record date. I can enter the name and other info but when it comes to the date fields it will not let me fill them in. Got any Idea?
 
Where is the data coming from, you talk as if you are entering it in the query? Where does record date fit in?

Brian
 
I am. When I try and fill in the Arrival date and the departure date it will not let me. But I can fill in the Names: Phone#: and other fields.
 
So you are populating a table by entering data in a query. OK! When you say it wont let you enter a date what actually happens?

Brian
 
So you are populating a table by entering data in a query. OK! When you say it wont let you enter a date what actually happens?

Brian

Well in blinks like I can type it in but when I type nothing comes up. I made another database query and I can type in the second one I made. However I do not know what I did different.

Cheers,
Matt
 

Users who are viewing this thread

Back
Top Bottom