Use the DateDiff function instead.

C  = Datediff(A, B)

DateDiff Function 

Returns a Variant (Long) specifying the number of time intervals
between two specified dates.

Syntax

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

The DateDiff function syntax has these named arguments:

Part Description 
interval Required. String expression that is the interval of time you
use to calculate the difference between date1 and date2. 
date1, date2 Required; Variant (Date). Two dates you want to use in
the calculation. 
firstdayofweek Optional. A constant that specifies the first day of
the week. If not specified, Sunday is assumed. 
firstweekofyear Optional. A constant that specifies the first week of
the year. If not specified, the first week is assumed to be the week
in which January 1 occurs. 

--- In [email protected], "nikita.malhotras"
<[EMAIL PROTECTED]> wrote:
>
> 
> Hi Friends,
> 
> I have three columns A, B & C (Date Data Type) containing Dates in
> following formats:
> 
>                       1/14/2008 10:45 AM
> 
> above format is for all three above columns within a table.
> 
> 1.  Now I wish to contain C = A - B.  I mean substraction of A & B in to
> C.  While doing so through programming (VBA), I am getting wrong results
> in A.  Please help me if how I can do so and I need urget relpy on the
> same.
> 
> Procedure that I am following is quite simple through VBAL:
> 
>         C.Value = A. Value - B.Value
> 
> I am writing this code in VBA for form to update values in Table.
> 
> However, results are correct.
> 
> => The result should also be in 1/14/2008 08:12 AM format.
> 
> Looking forward for your reply at [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> .
> 
> I shall be highly thankful to you.
> 
> Regards,
> 
> Nik.
> 
> 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to