By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

Delete record crashes access

P: 29
Every time i attempt to delete a record access crashes

i have a main form

a sub form
[Meeting ID]

and a sub sub form

so long as i do not expand the sub sub form i can delete the record form th esub form

but if i expand the sub sub form it crashes

is there a way to avoid this
Jan 21 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 1,923
If you have the Master/Child links setup between the form and between the nested subforms, the following code behind the form from which you select the record to be deleted should work:
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.RunCommand acCmdSelectRecord
  2.     DoCmd.RunCommand acCmdDeleteRecord
If it does not work, post the master/child links between the nested subforms and the main form.
Jan 22 '09 #2

P: 29
im sorry for sounding new.

But do i put this code on the "On Delete" event or .. well i just don't know

i really appreciate the help
Jan 23 '09 #3

Expert 100+
P: 1,923
No, place the code behind a button on your form, as shown below:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnDelete_Click()
  2. On Error GoTo Err_btnDelete_Click
  4. Dim Cancel As Integer
  5. Dim intReturn As Integer
  7. On Error GoTo Err_btnDelete_Click
  9. intReturn = MsgBox("Warning: You are about to delete this record. If you don't want to do this, Click the cancel button.", vbOKCancel)
  11. If intReturn = vbCancel Then
  12.         GoTo Exit_btnDelete_Click
  13. Else
  14.          DoCmd.RunCommand acCmdSelectRecord 
  15.          DoCmd.RunCommand acCmdDeleteRecord
  16.          Me.Refresh
  17. End If
  19. Exit_btnDelete_Click:
  20.     Exit Sub
  22. Err_btnDelete_Click:
  23.     MsgBox "Error# " & Err.Number & " " & Err.Description
  24.     Resume Exit_btnDelete_Click
  26. End Sub
Jan 23 '09 #4

P: 29
ah i see

thanks ill give that a shot
Jan 23 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.