Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2005, 08:41 PM
Authorized User
 
Join Date: Feb 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get rid of the "You're about to delete ... " msg.

This sounds so silly. I've been trying for an hour to delete a record found in a tabletype recordset without displaying the Access standard message "You are about to delete x records..." you know.

I already have my own msgbox() function that asks for confirming the deletion.

I've tried DoCmd.SetWarnings False and later back to True.
I've tried SetOption with "Confirm Record Changes" to False then back to True. I also tried a few other ones to no avail.

I am sure I did that in the past and had no problems at all finding the information. Here's a portion of the code:

... (more)
    If MsgBox("Delete record?") = vbYes Then
        Dim dbs As DAO.Database
        Dim rst As DAO.Recordset

        Set dbs = CurrentDb()
        Set rst = dbs.OpenRecordset("tblzzz", dbOpenTable)

        With rst
            .Index = "PrimaryKey"
            .Seek "=", Me!EtudID, Me!FinDetailAn

            If Not .NoMatch Then
                .Delete
            Else
                DisplayExclamation "Not found"
            End If
        End With
    Else
... (more)

This code is in the OnDelete event of the form. As I think of it could it belong to another event like BeforeDelConfirm? Hum I'm on my way to try this.

If anybody can help I would appreciate.

Daniel
__________________
Daniel
 
Old February 21st, 2005, 09:58 PM
Authorized User
 
Join Date: Feb 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's something else I tried. In the Debug Window I disable manually the Confirm Record Changes with the following:

SetOption "Confirm Record Changes",false

I run the procedure and I am not bothered by any message. When, on the other hand, I add the line above at the top of my procedure I still get the standard Access message!! Remember, I mentionned that SetWarning False didn't help at all. Anybody knows hpw to avoid this message?

Thank you

Daniel
 
Old February 22nd, 2005, 10:27 AM
Authorized User
 
Join Date: Feb 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh well. I used another approach after all. A good old delete query with a criterion reading the current record. And it works perfectly, no Access message.

Isn't it odd that I reply to my own post? 8)

    If MsgBox("Delete record?") = vbYes Then
        DoCmd.SetWarnings False
        ' Delete query using the current foreign key
        ' as a criterion.
        DoCmd.OpenQuery "qryDeleteRecord"
        DoCmd.SetWarnings True
    Else
        Cancel = True
    End If


Daniel
 
Old February 23rd, 2005, 02:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Good reasoning. Thanks for sharing it with us.

Clive Astley





Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you get Rid of quotes hewstone999 Access VBA 1 April 15th, 2008 10:42 AM
Get rid of the "Update Messages" hewstone999 Access VBA 1 March 10th, 2008 06:47 AM
How do I get rid of this comma?!?!?!?! tsindos Classic ASP Databases 10 February 16th, 2006 12:55 AM
How to get rid of this comma!!?! gilgalbiblewheel Classic ASP Databases 15 August 8th, 2005 06:41 PM
how to get rid of &nsbp; Lee8mm VB.NET 0 July 21st, 2003 07:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.