Update or CancelUpdate without AddNew or Edit
How to subtract date and the result will be number of days?
Coz i have a table name tblDate, fieldname subject, date received, date release and no. of days elapsed,. I have a form name DTS Entry, textbox name subject, date received, date released and no. of days released. the data type of subject is text, the date received and date released are date/time, and the no. of days elapsed is text. the textbox no. of days elapsed is equal to current date minus date released. I want to automatically the form will be updated or the textbox no. of days elapsed will be updated to the subtraction of current date and date released.
This is the code i made but i encounter an error:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Combo165 = "Done" Then
Me.[no. of days elapsed] = "0"
Else
If Me.Combo165 = "Pending" Then
Me.[no. of days elapsed] = [current date] - [date released]
End If
End If
End Sub