DateDiff

A

Andre Adams

Hello all,

How would I run a query that would give me the total days in between the
original date and the current date? The only date that I have in the
database is the original date. How would I tell access to subtract that from
the current date to come up with the number of days in between?
 
A

Andre Adams

Thank you very much! Perfect!

Douglas J. Steele said:
DateDiff("d", [OriginalDate], Date())

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andre Adams said:
Hello all,

How would I run a query that would give me the total days in between the
original date and the current date? The only date that I have in the
database is the original date. How would I tell access to subtract that
from
the current date to come up with the number of days in between?
 
A

Andre Adams

Sorry. Me again. I was wondering. Because I'm doing this query to run from
the last settlement date, I only need the last transaction on the books for
each Manager. So Broker X might have last traded on 04/30/2008 and Broker Y
might have last traded on 05/15/2008. Those are the dates that I need the
database to calculate from. Is there a way?

Douglas J. Steele said:
DateDiff("d", [OriginalDate], Date())

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andre Adams said:
Hello all,

How would I run a query that would give me the total days in between the
original date and the current date? The only date that I have in the
database is the original date. How would I tell access to subtract that
from
the current date to come up with the number of days in between?
 
D

Douglas J. Steele

You can create a query that returns the last date for each broker using:

SELECT Broker, Max(TransactionDate) As LastTrade
FROM MyTable
GROUP BY Broker

You can then use that query as the basis for whatever it is you're trying to
do.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andre Adams said:
Sorry. Me again. I was wondering. Because I'm doing this query to run
from
the last settlement date, I only need the last transaction on the books
for
each Manager. So Broker X might have last traded on 04/30/2008 and Broker
Y
might have last traded on 05/15/2008. Those are the dates that I need the
database to calculate from. Is there a way?

Douglas J. Steele said:
DateDiff("d", [OriginalDate], Date())

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andre Adams said:
Hello all,

How would I run a query that would give me the total days in between
the
original date and the current date? The only date that I have in the
database is the original date. How would I tell access to subtract
that
from
the current date to come up with the number of days in between?
 
A

Andre Adams

You're great man, thanks. I have got to learn to write SQL statements.

Douglas J. Steele said:
You can create a query that returns the last date for each broker using:

SELECT Broker, Max(TransactionDate) As LastTrade
FROM MyTable
GROUP BY Broker

You can then use that query as the basis for whatever it is you're trying to
do.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andre Adams said:
Sorry. Me again. I was wondering. Because I'm doing this query to run
from
the last settlement date, I only need the last transaction on the books
for
each Manager. So Broker X might have last traded on 04/30/2008 and Broker
Y
might have last traded on 05/15/2008. Those are the dates that I need the
database to calculate from. Is there a way?

Douglas J. Steele said:
DateDiff("d", [OriginalDate], Date())

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello all,

How would I run a query that would give me the total days in between
the
original date and the current date? The only date that I have in the
database is the original date. How would I tell access to subtract
that
from
the current date to come up with the number of days in between?
 

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