Buttons Buttons Buttons

  • Thread starter Thread starter DaveB
  • Start date Start date
D

DaveB

Is it possible to use a botton to subtract one field from
another? I tried to use the following, but it didn't
work.

Private Sub Command117_Click()
ME1TotalTimetoBill = sum CompletionDateTime -
StartDateTime
End Sub
 
Assuming your text boxes are name TotalTimeToBill, CompletionDateTime and
StartDateTime, you can use:

Me.TotalTimeToBill = Me.CompletionDateTime - Me.StartDateTime

However, I doubt that will be very useful to you, given the way Access
stores times (as a fraction of a day), so you'll probably be better off
using the DateDiff function:

Me.TotalTimeToBill = DateDiff("n", Me.CompletionDateTime, Me.StartDateTime)

will give you the number of minutes between the two times.
 
Back
Top