Greetings,
I am a light weight database designer and vba code writer. I need some help.
I have a form with a delete button. Every time I click the Delete button, I need the form to warn me before deleting the record from the table or related tables.
Currently, when I click the delete button, it deletes the record with no warning.
Here is my code:
______________________________
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub
________________________________
Private Sub Form_Current()
' ok here is the problem code
' when I delete this code, I get the prompt before
' deleting a record
On Error GoTo Current_Err
If GrandTotal > "0" Then
Gift_toDate = GrandTotal
End If
If (OptionGroup.Value = True) Then
ChurchorIndividualText = "Church"
ElseIf (OptionGroup.Value = False) Then
ChurchorIndividualText = "Individual"
End If
Current_End:
Exit Sub
Current_Err:
MsgBox Err.Description
Resume Current_End
End Sub
_______________________________
I have tried removing different pieces of it, (ie. breaking it down) and nothing helps. But I need all these parts for the form to work correctly.
If I remove the secound private sub completely, the delete sub gives me no trouble.
Any help on how to re-write the 2nd part of this code so that the form will alert me before deleting a record would be helpful. I am totallly stumped here.
thanks
mike
I am a light weight database designer and vba code writer. I need some help.
I have a form with a delete button. Every time I click the Delete button, I need the form to warn me before deleting the record from the table or related tables.
Currently, when I click the delete button, it deletes the record with no warning.
Here is my code:
______________________________
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub
________________________________
Private Sub Form_Current()
' ok here is the problem code
' when I delete this code, I get the prompt before
' deleting a record
On Error GoTo Current_Err
If GrandTotal > "0" Then
Gift_toDate = GrandTotal
End If
If (OptionGroup.Value = True) Then
ChurchorIndividualText = "Church"
ElseIf (OptionGroup.Value = False) Then
ChurchorIndividualText = "Individual"
End If
Current_End:
Exit Sub
Current_Err:
MsgBox Err.Description
Resume Current_End
End Sub
_______________________________
I have tried removing different pieces of it, (ie. breaking it down) and nothing helps. But I need all these parts for the form to work correctly.
If I remove the secound private sub completely, the delete sub gives me no trouble.
Any help on how to re-write the 2nd part of this code so that the form will alert me before deleting a record would be helpful. I am totallly stumped here.
thanks
mike