A
Alex
I have a form with a subform The form is unbound and it displays a single
record in a table. The subform is in listview mode and I use it to aid in
navigating the records of the main form. On the Current event of the subform I
have the following code.
Private Sub Form_Current()
Me.Parent.RecordSource = "SELECT * FROM T_ProviderTypes WHERE
T_ProviderTypes.ProviderTypeID = " & ProviderTypeID
End Sub
(While the main form and the subform display data that comes from the same
underlying table, the subform uses a query for its record source).
In my main form I use the following code for record deletion:
Private Sub CommandDelete_Click()
If MsgBox("Are you sure you want to delete the record?", vbYesNo) = vbYes
Then
DoRecordDeletion
End If
End Sub
Private Sub DoRecordDeletion()
Dim TheID As Integer
Dim varBookmark As String
Dim rsClone As DAO.Recordset
varBookmark = Me.F_ProviderTypesSubForm.Form.Recordset.Bookmark
Set rsClone = Me.F_ProviderTypesSubForm.Form.RecordsetClone
rsClone.Bookmark = varBookmark
rsClone.MovePrevious
If rsClone.BOF Then
rsClone.MoveFirst
End If
TheID = rsClone.Fields!ProviderTypeID
Me.F_ProviderTypesSubForm.Form.Recordset.Delete
Me.F_ProviderTypesSubForm.Form.Recordset.Requery
Me.F_ProviderTypesSubForm.Form.Recordset.FindFirst ("ProviderTypeID = " &
TheID)
Set rsClone = Nothing
End Sub
I'm finding that the Current event of the subform is not getting fired when I
reposition the record pointer in the subform via its recordset's FindFirst
method (at the end of the DoRecordDeletion routine), and this is causing a
problem as I depend on the Current event to keep both forms synchronized. Does
anybody know why the Current event of the subform is not getting fired?
record in a table. The subform is in listview mode and I use it to aid in
navigating the records of the main form. On the Current event of the subform I
have the following code.
Private Sub Form_Current()
Me.Parent.RecordSource = "SELECT * FROM T_ProviderTypes WHERE
T_ProviderTypes.ProviderTypeID = " & ProviderTypeID
End Sub
(While the main form and the subform display data that comes from the same
underlying table, the subform uses a query for its record source).
In my main form I use the following code for record deletion:
Private Sub CommandDelete_Click()
If MsgBox("Are you sure you want to delete the record?", vbYesNo) = vbYes
Then
DoRecordDeletion
End If
End Sub
Private Sub DoRecordDeletion()
Dim TheID As Integer
Dim varBookmark As String
Dim rsClone As DAO.Recordset
varBookmark = Me.F_ProviderTypesSubForm.Form.Recordset.Bookmark
Set rsClone = Me.F_ProviderTypesSubForm.Form.RecordsetClone
rsClone.Bookmark = varBookmark
rsClone.MovePrevious
If rsClone.BOF Then
rsClone.MoveFirst
End If
TheID = rsClone.Fields!ProviderTypeID
Me.F_ProviderTypesSubForm.Form.Recordset.Delete
Me.F_ProviderTypesSubForm.Form.Recordset.Requery
Me.F_ProviderTypesSubForm.Form.Recordset.FindFirst ("ProviderTypeID = " &
TheID)
Set rsClone = Nothing
End Sub
I'm finding that the Current event of the subform is not getting fired when I
reposition the record pointer in the subform via its recordset's FindFirst
method (at the end of the DoRecordDeletion routine), and this is causing a
problem as I depend on the Current event to keep both forms synchronized. Does
anybody know why the Current event of the subform is not getting fired?