Your delete button should have event procedure against its On Click property.
Can you post this code and we can check and advise ?
> Thanks for your posts guys.
> Where do I find the "delete code?" I have tried using VBA (by putting an
[quoted text clipped - 38 lines]
> > > TIA
> > > Rich
Here is the onclick event procedure for Delete Button:
Private Sub Remove_Vehicle_From_Database_Click()
On Error GoTo Err_Remove_Vehicle_From_Database_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Dim bAllow As Boolean
bAllow = Not Me.AllowEdits
Me.AllowEdits = bAllow
Me.AllowAdditions = bAllow
Me.AllowDeletions = bAllow
Me.ComLokVehRec.Caption = IIf(bAllow, "&Lock", "Un&Lock")
Me.Label132.Visible = IIf(bAllow, "False", "True")
Me.Label135.Visible = IIf(bAllow, "True", "false")
Me.Box123.BorderColor = IIf(bAllow, "255", "16711680")
Me.Box133.Visible = IIf(bAllow, "False", "True")
Me.Box134.Visible = IIf(bAllow, "True", "False")
Me.Remove_Vehicle_From_Database.Visible = IIf(bAllow, "True", "False")
Me.Combo112.Locked = False
Exit_Remove_Vehicle_From_Database_Click:
Exit Sub
Err_Remove_Vehicle_From_Database_Click:
MsgBox Err.Description
Resume Exit_Remove_Vehicle_From_Database_Click
End Sub
I tried putting
Application.Echo False before the first line of the following two lines and
after the second
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
(Is this right?) I also put Application.Echo True at where I think the
error trap is, as shown on my last post.
When I tried deleting on the form, the previous record wasn't displayed but
Access then locked up and I had to restart Access. I'm having lots of
crashes... but, putting that to one side for now, should the procedure work
as described above? Am I doing it right?
> Your delete button should have event procedure against its On Click property.
> Can you post this code and we can check and advise ?
[quoted text clipped - 41 lines]
> > > > TIA
> > > > Rich
Dennis - 30 Sep 2005 11:53 GMT
Add my 3 Application.Echo lines as below
> Here is the onclick event procedure for Delete Button:
>
> Private Sub Remove_Vehicle_From_Database_Click()
> On Error GoTo Err_Remove_Vehicle_From_Database_Click
>
Application.Echo False
> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
> Application.Echo True
> Dim bAllow As Boolean
> bAllow = Not Me.AllowEdits
[quoted text clipped - 15 lines]
> Err_Remove_Vehicle_From_Database_Click:
> Application.Echo True
MsgBox Err.Description
> Resume Exit_Remove_Vehicle_From_Database_Click
>
[quoted text clipped - 58 lines]
> > > > > TIA
> > > > > Rich
Rich1234 - 30 Sep 2005 12:26 GMT
Thanks Dennis. It works.
I did try this before but Access kept crashing. I have just turned off
Update Auto Name Correct which has fixed this problem, and many others!
Many thanks for sage advice
Rich
> Add my 3 Application.Echo lines as below
>
[quoted text clipped - 90 lines]
> > > > > > TIA
> > > > > > Rich
Rich1234 - 10 Oct 2005 13:15 GMT
Hi Dennis
I have used your technique in a continuous subform which works beautifully
(record about to be deleted is still showing when delete confirm message is
displayed.)
I have just customised the delete confirm message and have included fields
(First Names and Surname) from the record about to be deleted for further
confirmation for the user. But the names from the next record in the table
appear in the message (even though the correct record is then actually
deleted.) And if I select the last driver in the form for deletion, the
message uses the names from the previous record.
Is this a problem which can be overcome by the Application.Echo statement,
presumably somewhere in the Before Delete Confirm event? Here is the code
I'm using in the Before Delete event:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue ' Display custom dialog box.
If MsgBox("Are you sure you want to remove the driver " & [First Names]
& " " & Surname & " from this vehicle?" , vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub
If you're able to help and share your expertise, I'd be immensely grateful.
Thanks
Rich
> Thanks Dennis. It works.
> I did try this before but Access kept crashing. I have just turned off
[quoted text clipped - 97 lines]
> > > > > > > TIA
> > > > > > > Rich