Hi there. I'm new to programming in VBA. I am currently doing my internship and I am responsible for the programming part in Access-VBA.
The programm is already made by the previos intern, so I just need to find the errors and fixed it.
I have a form named frmMessauftragsverwaltung and a subform named sfmMesstermine with sfmEndlosMesstermine as the Source Object.
Inside the subform is a Delete Button, assigned at each row of the record displayed.
When I try to delete a record, an Error 3200 appears, saying
The Data cannot be deleted or changed because the Table "___" in relationship with another table. Something like that.
The code is below:
What could possibly be the problem? Before this it works out fine until I added some combobox filter. But that should not affect the delete button should it?
The programm is already made by the previos intern, so I just need to find the errors and fixed it.
I have a form named frmMessauftragsverwaltung and a subform named sfmMesstermine with sfmEndlosMesstermine as the Source Object.
Inside the subform is a Delete Button, assigned at each row of the record displayed.
When I try to delete a record, an Error 3200 appears, saying
The Data cannot be deleted or changed because the Table "___" in relationship with another table. Something like that.
The code is below:
Code:
Private Sub btnLoeschen_Click()
InfoboxLaden
If Not Me.NewRecord Then
Dim eingabe As String
eingabe = InputBox("Please insert password.", "Delete Record?")
If eingabe = modData.getPW Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
ElseIf eingabe <> "" Then MsgBox "Wrong password", , "Error"
End If
End If
End Sub
What could possibly be the problem? Before this it works out fine until I added some combobox filter. But that should not affect the delete button should it?