I am working on a training database. I have a field "DateSerBeg" and a field
"DateSerEnd". I want the "DateSerEnd" to default to "DateSerBeg". Any
suggestions?
The simplest way to do this is to use a Form to do all your data entry (this
is a good idea in any case; table datasheets aren't designed for the purpose).
Open the Form in design view, and find the "AfterUpdate" event on the Events
tab of the DateSerBeg control's properties. Click the ... icon by it, and
select Code Builder. Access will open a code-editing window with the Sub and
End Sub lines already filled in. Edit it to:
Private Sub DateSerBeg_AfterUpdate()
If IsNull(Me!DateSerEnd) Then
Me!DateSerEnd = Me!DateSerBeg
End If
End Sub
This code will check to see if there is anything already in DateSerEnd, and if
not, copy the DateSerBeg value into the control.