Charlie,
<<Any ideas why?>>
No. You haven't given me enough information.
If I understand you correctly, you have two textboxes; one (I'll call
txtDate) that contains the reference date; the other (I'll call txtNewDate)
that will contain txtDate-50 days.
txtNewDate probably has a DefaultValue something like this:
=DateAdd("d", -50, Forms!frmMyForm!txtSomeTextBox)
If not, then you probably have code to update txtNewDate based on what the
user enters in txtDate:
Private Sub txtDate_AfterUpdate()
Me!txtNewDate = DateAdd("d", -50, Me!txtDate)
End Sub
And you're saying the value in txtNewDate does not update a table field when
you (a) move to another record, or (b) close the form.
There are only two things that can be going wrong:
1. Something is causing the form to NOT save the record. This could be:
(a) Some sort of error prior to or during the save; or
(b) Somewhere, you have Me.Undo.
To test it, write the following code in the form's BeforeUpdate and
AfterUpdate events, and see what happens:
Private Sub Form_BeforeUpdate(Cancel As Integer)
MsgBox "BeforeUpdate: " & Me!txtDate & vbCrLf & Me!txtNewDate
End Sub
Private Sub Form_AfterUpdate()
MsgBox "AfterUpdate: " & Me!txtDate & vbCrLf & Me!txtNewDate
End Sub
2. txtNewDate is not bound, or isn't bound to the field you think it is.
If neither of these things highlight the problem, we'll need to deep a
little deeper, but you will have to part with more information than you have
so far.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html