Reputation: 195
I've the following code which deletes a all data from a table in access. I however also would like ot show a message box saying "ok you didn't delete anthing when the user presses NO when the screen pops up with "Are you sure....".
Does anybody know how I can create thing like this?
Public Function DeleteDataSAP()
DoCmd.RunSQL "DELETE * FROM tb_Organisatiestructuur"
End Function
Upvotes: 0
Views: 49
Reputation: 12353
Try this
Sub main()
Dim retval
retval = MsgBox("Are you sure you want to delete?", vbYesNo + vbDefaultButton2)
If retval = vbYes Then
DeleteDataSAP
ElseIf retval = vbNo Then
MsgBox "ok you didn't delete anthing "
End If
End Sub
Public Function DeleteDataSAP()
DoCmd.RunSQL "DELETE * FROM tb_Organisatiestructuur"
End Function
Upvotes: 1