DoCmd.Close acform,, in VBA closes whole Access Database

M

Marcus Bamford

CODING used
-------------------
Response = msgbox("You are about to delete this Contact's details. Is this
Correct?", vbYesNo + vbDefaultButton2, "WARNING")

If Response = vbNo Then Exit Sub

DoCmd.SetWarnings False

DoCmd.RunSQL "delete * from tablecontact where contactno = " & Me.ContactNo
& ";"
DoCmd.RunSQL "delete * from tablecontactextramember where Memconno = " &
Me.ContactNo & ";"

DoCmd.SetWarnings True

Response = msgbox("Contact Record Deleted", vbOKOnly, "Information")

DoCmd.Close acForm, "formcontactmemberedit", acSaveNo
 
B

Brian

Marcus Bamford said:
CODING used
-------------------
Response = msgbox("You are about to delete this Contact's details. Is this
Correct?", vbYesNo + vbDefaultButton2, "WARNING")

If Response = vbNo Then Exit Sub

DoCmd.SetWarnings False

DoCmd.RunSQL "delete * from tablecontact where contactno = " & Me.ContactNo
& ";"
DoCmd.RunSQL "delete * from tablecontactextramember where Memconno = " &
Me.ContactNo & ";"

DoCmd.SetWarnings True

Response = msgbox("Contact Record Deleted", vbOKOnly, "Information")

DoCmd.Close acForm, "formcontactmemberedit", acSaveNo
-----------------------------------

When it gets to close command it closes the database and not just the form.

is it something I have done wrong?

Perhaps you have some code in the form's Close event that closes the
database?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top