Adding Days to a Date

  • Thread starter Thread starter tim
  • Start date Start date
T

tim

I get a text file and link it to a Access table. I then transfer it to
another table with a text field that is a date and data is in this format:
091105. I run a query to add forward slashes:



Left$([date],2) & "/" & Mid$([date],3,2) & "/" & Right$([date],2)



The problem is I need to add 10 days to this date to be used in a merge
document. The only way I am able to do this is to change the field type to
date/time after I transfer the data and run the above-mentioned query. I
have tried changing the field type to date/time before the transfer and it
does not work. Below is part of the query I use to add 10 days to the date.



[date]+10 AS grcExpDate



What am I doing wrong?

Any help would appreciated.



Tim

Access 2000
 
If you use the TransferText Method/Action, you can use an import spec. The
import spec can translate the non-standard date field on input so that it is
imported as a date/time data type. To create the import spec, you must
import the file ONCE manually and save the spec. Once that is done, you can
refer to the spec any time you need to import that same file again.

BTW - Date is a poor choice as a name since it is the name of a function and
as such can lead to confusion in oh so many ways. Avoid function and
property names as well as special characters and embedded spaces.
 
Try
CDate(Left$([date],2) & "/" & Mid$([date],3,2) & "/" & Right$([date],2)) +
10 as grcExpDate
 
That works!

Thank you
Tim


Duane Hookom said:
Try
CDate(Left$([date],2) & "/" & Mid$([date],3,2) & "/" & Right$([date],2)) +
10 as grcExpDate

--
Duane Hookom
MS Access MVP
--

tim said:
I get a text file and link it to a Access table. I then transfer it to
another table with a text field that is a date and data is in this format:
091105. I run a query to add forward slashes:



Left$([date],2) & "/" & Mid$([date],3,2) & "/" & Right$([date],2)



The problem is I need to add 10 days to this date to be used in a merge
document. The only way I am able to do this is to change the field type to
date/time after I transfer the data and run the above-mentioned query. I
have tried changing the field type to date/time before the transfer and it
does not work. Below is part of the query I use to add 10 days to the
date.



[date]+10 AS grcExpDate



What am I doing wrong?

Any help would appreciated.



Tim

Access 2000
 
Back
Top