Buttons Buttons Buttons

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
 
D

Douglas J. Steele

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top