Hello! I have a form (ThoughtsF) on my db that I wish to give the user the option of keeping it of deleting it. The form (ThoughtsF) opens with the There is a table (ThoughtsT) and a query (ThoughtsQ). I have tried with a macro and I have tried with the below code. As you can see, I have even tried including a delay between the form being closed and being deleted. To no avail. I believe there is only a need to delete the form as the table and query do not take up much space.
The "Delete" option is under a button on the form.
The form “ThoughtsF” is in the On Load Event procedure of another form. They both open at the same time.
If the user presses Yes, the form should be deleted, never to be seen again.
If they press No, the message box should disappear.
The code I have been working on/ with is below. Any advice will be welcome. Leon
Code:
Private Sub DeleteThought_Click()
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Are you sure you want to throw this away?", vbYesNo, "Delete Thought of the Day")
DoCmd.Close acForm, "ThoughtsF"
DoCmd.Close acTable, "ThoughtsT"
DoCmd.Close acQuery, "ThoughtsQ"
' Me.TimerInterval = 2000
DoCmd.DeleteObject "ThoughtsF"
DeleteThought_Click_Err:
End Sub