Date Diff

  • Thread starter frustratedwthis
  • Start date
F

frustratedwthis

I am trying to put in an expression to figure the difference between the Date
of the PO and the delivery date. I can not seem to make this work....any
help would be greatly appreciated!!!
 
D

Dirk Goldgar

frustratedwthis said:
I am trying to put in an expression to figure the difference between
the Date of the PO and the delivery date. I can not seem to make
this work....any help would be greatly appreciated!!!

What did you try? Do you want the difference in days? For that,

DateDiff("d", [PODate], [DeliveryDate])

should work. But other values for the first argument to DateDiff may
give you results different from what you expect.
 
F

frustratedwthis

I tried the expresion you gave. It still just stays blank. Doesn't give an
answer. I am working this in a table, should I be using a query?

Dirk Goldgar said:
frustratedwthis said:
I am trying to put in an expression to figure the difference between
the Date of the PO and the delivery date. I can not seem to make
this work....any help would be greatly appreciated!!!

What did you try? Do you want the difference in days? For that,

DateDiff("d", [PODate], [DeliveryDate])

should work. But other values for the first argument to DateDiff may
give you results different from what you expect.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

frustratedwthis said:
I tried the expresion you gave. It still just stays blank. Doesn't
give an answer. I am working this in a table, should I be using a
query?

Dirk Goldgar said:
frustratedwthis said:
I am trying to put in an expression to figure the difference between
the Date of the PO and the delivery date. I can not seem to make
this work....any help would be greatly appreciated!!!

What did you try? Do you want the difference in days? For that,

DateDiff("d", [PODate], [DeliveryDate])

should work. But other values for the first argument to DateDiff may
give you results different from what you expect.

You can't create a calculated field in a table, but that's good, because
there's no point in doing so -- calculated (and recalculable) values
should not be stored. You can create a calculated field in a query. In
the query design grid you'd define a column like this:

DaysToDelivery: DateDiff("d", [PODate], [DeliveryDate])

In SQL view, the corresponding SQL statement would be something like
this:

SELECT
<list of fields...>,
DateDiff("d", [PODate], [DeliveryDate]) AS DaysToDelivery
FROM SomeTable
<... maybe other keywords ...>;

Alternatively, you can define the calculation as the controlsource of a
calculated control on a form or report:

=DateDiff("d", [PODate], [DeliveryDate])

Of course, both fields must not be Null (blank), if you hope to get a
non-Null result.
 
Top