Can't Delete Record (1 Viewer)

Kevin_S

Registered User.
Local time
Today, 07:38
Joined
Apr 3, 2002
Messages
635
Howdy All:)

I am somewhat stumped on a problem I have and I am hoping one of you good people will be able to provide an insight on what isn't working in my db

I have a form that is based off my primary admin table and has exactly 14 tabs on it relating to the different categories of data in the db. Each tab has a particular subform on it that relates to the overall record in the admin table. On this same form I have built a delete button so that users should be able to delete a record if they so find appropriate. This delete record button is set up to delete the current record on the form, which should, then delete all the corresponding information in the database related to that specific record because the admin table if the link table for all of the other database items.

When the button is pressed it asks the user if they are sure they want to delete - if they choose yes the delete function runs and a message informs the user that the record was deleted. If they choose no - the user receives a message that the action was aborted. Also... before the delete function runs the code checks to see if the field is null or not - if it is there is nothing to delete then the user is informed that the action was cancelled. the following is the code for the button:

On Error GoTo Err_Command27_Click
If MsgBox("Are you sure you want to Delete? All delete actions are final...", vbYesNo, "Confirm Delete Record") = vbYes Then
DoCmd.SetWarnings False
'check to make sure SITEID field isnt empty
If IsNull(SITEID) Then
MsgBox "Error Occured! DELETE Record Failed...", vbExclamation, "Delete Record Message"
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "Record Deleted", vbInformation
DoCmd.SetWarnings True
End If
ElseIf vbNo Then
MsgBox "Delete record aborted", vbOKOnly
Else
End If
Exit_Command27_Click:
Exit Sub

Err_Command27_Click:
MsgBox "Error Occured! DELETE Record Failed...", vbExclamation, "Delete Record Message"
Resume Exit_Command27_Click

Does anyone have an idea why the code is running (I'm getting all the appropriate message boxes) but the delete action is not taking place???

Any help on this is fully appreciated!!!!

p.s. I can send the database if this was at all unclear

thanks in advance!
Kevin
 

Users who are viewing this thread

Top Bottom