Microsoft Office Tutorials and References
In Depth Information
Triggering a New Form Based on a Subform Selection
the data. When the Form View menu bar is active, note that the filter button
appears to be pressed!
The extraction from the [ID] value is done with Me.sfrmName.Form.ID. Notice
that an extra .Form is used before referring to the key field from the subform.
The frmNameUpdate is slightly different in the header because there are two
new buttons: Reset and Save. The Reset button is used to undo changes when
the record has been partially edited and the user needs to start over. The
Cancel and Save buttons are self-explanatory.
The code used is as follows:
Option Compare Database¶
Option Explicit¶
' * * * * *
Private Sub btnCancel_Click()¶
'Before the form is closed, reset the field values¶
'if the user has changed something¶
If Me.Dirty Then¶
' reset all fields to their old value¶
End If¶
End Sub¶
' * * * * *
Private Sub btnReset_Click()¶
' reset all fields to the old value¶
' make sure they are displayed¶
End Sub¶
' * * * * *
Private Sub btnSave_Click()¶
' Close form and Access will save the data¶
End Sub¶
' * * * * *
Private Sub Form_Activate()¶
' Maximize form when it becomes active¶
End Sub¶
The new items here are the Me.Undo and the Me.Dirty. When looking into the
properties that Access expands after a field, note a property named OldValue,
as shown in the following figure.
Search JabSto ::

Custom Search