D
deb
access 2003
Main form has a option group
Subform is a continuous form
if user changes the option group the subform data is deleted.
see code...
Private Sub optCTorSTorGEN_AfterUpdate()
If Me.NewRecord = False Then
strMsg = "Are you sure you want to change?" _
& vbCr & vbCr & "This will erase the corresponding data to allow for new
input."
ans = MsgBox(strMsg, vbYesNo, "Confirm Changes")
If ans = vbNo Then
Me.Undo
Me.optCTorSTorGEN.Requery
MsgBox "The data has NOT been changed.", vbExclamation,
"Important"
Me.UnitNo.Requery
Exit Sub
Else
'Prepare for deleting record
Me.f019WarrantyDetails.Form.AllowDeletions = True
Dim strPONumber As String
Dim strSQL As String
strWarrantyUnitID = WarrantyUnitID.Value
strSQL = "DELETE * FROM [t72WarrantyDetails] " _
& "WHERE [t72WarrantyDetails].WarrantyUnitID = " _
& strWarrantyUnitID
CurrentDb.Execute strSQL, dbFailOnError
' Me.Requery
' Me.UnitNo.Requery
End If
End If
If I take out the me.requery then user gets #Deleted in all fields. pretty
ugly
If I leave the me.requery it sets the record back to the first record in the
parent form. User will get confused
How can I delete the subform data and have it remain on the current parent
record with cleared fields?
Please help this is beyond my capabilities.
Main form has a option group
Subform is a continuous form
if user changes the option group the subform data is deleted.
see code...
Private Sub optCTorSTorGEN_AfterUpdate()
If Me.NewRecord = False Then
strMsg = "Are you sure you want to change?" _
& vbCr & vbCr & "This will erase the corresponding data to allow for new
input."
ans = MsgBox(strMsg, vbYesNo, "Confirm Changes")
If ans = vbNo Then
Me.Undo
Me.optCTorSTorGEN.Requery
MsgBox "The data has NOT been changed.", vbExclamation,
"Important"
Me.UnitNo.Requery
Exit Sub
Else
'Prepare for deleting record
Me.f019WarrantyDetails.Form.AllowDeletions = True
Dim strPONumber As String
Dim strSQL As String
strWarrantyUnitID = WarrantyUnitID.Value
strSQL = "DELETE * FROM [t72WarrantyDetails] " _
& "WHERE [t72WarrantyDetails].WarrantyUnitID = " _
& strWarrantyUnitID
CurrentDb.Execute strSQL, dbFailOnError
' Me.Requery
' Me.UnitNo.Requery
End If
End If
If I take out the me.requery then user gets #Deleted in all fields. pretty
ugly
If I leave the me.requery it sets the record back to the first record in the
parent form. User will get confused
How can I delete the subform data and have it remain on the current parent
record with cleared fields?
Please help this is beyond my capabilities.