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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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?
 
Back
Top