I want to be able to subtract(endtime-starttime) and have (repairtime+setuptime+pmtime) equal the value from endtime-starttime. EndTime and Starttime are 8:00(military time) and repairtime, setuptime, pmtime are 60(integers).

This is the code I have come up with so far:
MyTime = (Val(txtEndTime) - Val(txtStartTime))
MyWorkTime = (Val(txtRepairTime) + Val(txtSetupTime) + Val(txtPMTime))

If Not MyTime = MyWorkTime Then
MsgBox "The hours or minutes do not equal the total hour and minutes from Start Time and End Time."
txtRepairTime.SetFocus
Exit Sub
End If

The problem is when the correct time is put in the msgbox still comes up, but if the time is correct then I want the record to be added. And when the time is incorrect I don't want the record to be added. See the only way to find out if the time is correct the user will press on the add button and then the msgbox comes up only when the time is incorrect. But I don't think the times are even being compared. Can anyone help me with this problem?

Thanks jeffro