DateDiff problem

  • Thread starter Thread starter JoeP
  • Start date Start date
J

JoeP

I have a field that was imported as part of a text file. The field comes in
as a string of numbers 20090107 which I have converted to a date using
DateSerial function and it now appears in the calculated field StartConvert
as 2009-01-07.

I want to calculate how many days from the date in StartConvert to today's
date which right now is Jan 28 2010. I use the following calculation...

TestDate: DateDiff("d",[StartConvert],Date()). I receive the answer 20 when
in fact the answer should be 385.

What am I doing wrong?
Thanks for any help.

JoeP
 
Since you only want days, try this:

TestDate: Date() - [StartConvert]

This assumes that StartConvert is a date field.

A very strange possibility would be that the date in you PC is really wrong.
 
i was thinking the same thing that possibly the date on the PC is
wrong.

you could also try putting CDate([StartConvert]) to make sure it is
being processed as a correct date format in the datediff function.
 
I have a field that was imported as part of a text file. The field comes in
as a string of numbers 20090107 which I have converted to a date using
DateSerial function and it now appears in the calculated field StartConvert
as 2009-01-07.

What's your actual conversion expression? I.e. is StartConvert a Date/Time
field (the result of the DateSerial function directly), or a Text field
(wrapping DateSerial in a Format)?
 

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

Similar Threads

Datediff Help 3
Data Type Mismatch in Criteria Expression 4
DateDiff on blank fields? 4
DateDiff 4
DateDiff 13
DateDiff Problem 4
DateDiff not giving me a number!! 3
Access 2000: Data Type Mismatch in query 2

Back
Top