Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Formating 1

Status
Not open for further replies.

tjisaacs

Technical User
Jan 17, 2002
13
US
I have a table containing "collection date" this is a text format. I want to create a query that calculates the collection date plus 1 year, 2 year and 5 year. This is what I have but get results "Error" in data.

[collection date]+365

I tried a DateValue but still get Error




 
tjisaacs,

Have you tried the Value function?

Value([collection date])+365

Value will return the numeric value of a text string.

HTH
Binky ::)
><>
 
Consider changing the field that contains the Date to Date Time. Then your formular should work.
 
This gets interesting. For example, using the immediate debugger:
?date + 365
9/16/2003
? &quot;09/16/2003 + 365
09/16/2002 + 365
?#09/16/2002# + 365
9/16/2003


using the above you can see adding some number to a text string will give you the tet string concatonated with the number added, but if you mask the string date as a date, it will work just fine.

Use the following code

dim newdate as variant
dim thisdate as date
thisdate = [collection date]
newdate = thisdate + 365
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top