Date Difference

  • Thread starter Thread starter Armand
  • Start date Start date
A

Armand

Hiya Guys,

I am trying to find out the difference in days or months
between two dates in a database. The thing is that the
dates are not always the same. The fields will
be 'ArriveDate' and 'DepartDate' and they will change with
every different customer. I have seen the DafeDiff value
but it doesn't want to work (maybe I am doing it wrong).
Where would I put the formula? In the query? In which
field? Arrive or Depart Date?

Bye Guys.

Armand
 
If you are trying to find the difference betwen arrival date and departure
date, then use a separate field in your query
with the formula
datediff("D", date1, date2)

where d - day
you can use m for finding number of months between the two dates.
 
Hi KP,

The thing is that I have 2 fields: Datearrive and datediff
and I would not necessarily know what the exact dat for
any of them be. I would want the query to generate the
difference regardless if I know the 2 dates. The formula u
gave me seems to ask for specific dates.

Arigato.
 
Hiya Guys,

I am trying to find out the difference in days or months
between two dates in a database. The thing is that the
dates are not always the same. The fields will
be 'ArriveDate' and 'DepartDate' and they will change with
every different customer. I have seen the DafeDiff value
but it doesn't want to work (maybe I am doing it wrong).
Where would I put the formula? In the query? In which
field? Arrive or Depart Date?

Bye Guys.

Armand
To compute the difference in days....
In a query, add a new column.
Exp:DateDiff("d",[ArriveDate],[DepartDate])

To compute the difference in months .....
Exp:DateDiff("m",[ArriveDate],[DepartDate])
 
Hiya Guys,

I am trying to find out the difference in days or months
between two dates in a database. The thing is that the
dates are not always the same. The fields will
be 'ArriveDate' and 'DepartDate' and they will change with
every different customer. I have seen the DafeDiff value
but it doesn't want to work (maybe I am doing it wrong).
Where would I put the formula? In the query? In which
field? Arrive or Depart Date?

Bye Guys.

Armand

I'd suggest just typing the following expression in a vacant Field
cell in a query based on this table:

DaysThere: DateDiff("d", [ArriveDate], [DepartDate])

It may be that you left off the brackets - they're needed to tell
Access that you're passing a field value rather than the text string
"ArriveDate".

Note that it would be a great deal easier to answer your question if
you would post the SQL code or the expression that you tried, and and
indication of the error message other than "it didn't work"...
 
Back
Top