Full Version: Subtract date from another date
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
maxamis4
Hello folks,

I have a control labeled txt_date which has the formatting value of a short date. txt_date is equal to another control which is bound to a database and is stored as text field. When i try to subtract date() - txt_date, i get a display with an error.
example
bound control = '3/2/2007' as text
unbound control txt_Date = 3/2/2007 as short date

this should work right?
=date()-txt_date


If I recall correctly this function is possible since the control has a value formatted as a date. Why isn't it working?
fredrisg
You might try using the DateDiff Function to get the difference then use the DateAdd Function to add the difference to another date . . .

I'm not sure I've ever tried to use 'math' on dates . . . but I believe these functions should fit the bill.

Steve
maxamis4
Yeah that did it thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.