Stop Delete confirmation Box from displaying

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Galt

    Stop Delete confirmation Box from displaying

    I am trying to stop the Delete confirm message from showing up on a delete
    of all records in a table.
    The code (THAT IS NOT WORKING) is:

    Me.BeforeDelCon firm = "Form_BeforeDel Confirm"
    DoCmd.RunSQL "Delete from Offersheet"


    How can I stop this message from showing programmaticall y.
    I know I can uncheck the Record Changes Box in the edit/Find in the options
    dialog but I want to do this programmaticall y.

    Please post here or write me at jsys@yahoo.com

    Thanks for your help.


  • Wayne Morgan

    #2
    Re: Stop Delete confirmation Box from displaying

    A couple of options.

    1) Use DoCmd.SetWarnin gs to turn off the warnings.

    2) Use a different syntax to run the SQL

    CurrentDb.Query Defs("Delete from Offersheet").Ex ecute dbFailOnError

    --
    Wayne Morgan
    Microsoft Access MVP


    "John Galt" <jsys@yahoo.com > wrote in message
    news:UEcNb.9990 $Bv6.3025554@ne ws1.epix.net...[color=blue]
    > I am trying to stop the Delete confirm message from showing up on a delete
    > of all records in a table.
    > The code (THAT IS NOT WORKING) is:
    >
    > Me.BeforeDelCon firm = "Form_BeforeDel Confirm"
    > DoCmd.RunSQL "Delete from Offersheet"
    >
    >
    > How can I stop this message from showing programmaticall y.
    > I know I can uncheck the Record Changes Box in the edit/Find in the[/color]
    options[color=blue]
    > dialog but I want to do this programmaticall y.
    >
    > Please post here or write me at jsys@yahoo.com
    >
    > Thanks for your help.
    >
    >[/color]


    Comment

    • John Galt

      #3
      Re: Stop Delete confirmation Box from displaying

      Wayne,

      Thank you very much!
      That worked like a charm.

      John Galt


      "Wayne Morgan" <comprev_gothro ughthenewsgroup @hotmail.com> wrote in message
      news:g5dNb.5679 2$oI1.465@newss vr31.news.prodi gy.com...[color=blue]
      > A couple of options.
      >
      > 1) Use DoCmd.SetWarnin gs to turn off the warnings.
      >
      > 2) Use a different syntax to run the SQL
      >
      > CurrentDb.Query Defs("Delete from Offersheet").Ex ecute dbFailOnError
      >
      > --
      > Wayne Morgan
      > Microsoft Access MVP
      >
      >
      > "John Galt" <jsys@yahoo.com > wrote in message
      > news:UEcNb.9990 $Bv6.3025554@ne ws1.epix.net...[color=green]
      > > I am trying to stop the Delete confirm message from showing up on a[/color][/color]
      delete[color=blue][color=green]
      > > of all records in a table.
      > > The code (THAT IS NOT WORKING) is:
      > >
      > > Me.BeforeDelCon firm = "Form_BeforeDel Confirm"
      > > DoCmd.RunSQL "Delete from Offersheet"
      > >
      > >
      > > How can I stop this message from showing programmaticall y.
      > > I know I can uncheck the Record Changes Box in the edit/Find in the[/color]
      > options[color=green]
      > > dialog but I want to do this programmaticall y.
      > >
      > > Please post here or write me at jsys@yahoo.com
      > >
      > > Thanks for your help.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Tony Toews

        #4
        Re: Stop Delete confirmation Box from displaying

        "John Galt" <jsys@yahoo.com > wrote:
        [color=blue]
        >I am trying to stop the Delete confirm message from showing up on a delete
        >of all records in a table.[/color]

        To expand on Wayne's posting.

        I prefer, if DAO, to use Currentdb.Execu te strSQL,dbfailon error command instead of
        docmd.runsql. For ADO use CurrentProject. Connection.Exec ute strCommand,
        lngRecordsAffec ted, adCmdText

        If you're going to use docmd.setwarnin gs make very sure you put the True statement in
        any error handling code as well. Otherwise wierd things may happen later on
        especially while you are working on the app. For example you will no longer get the
        "Do you wish to save your changes" message if you close an object. This may mean
        that unwanted changes, deletions or additions will be saved to your MDB.

        Also performance can be significantly different between the two methods. One posting
        stated currentdb.execu te took two seconds while docmd.runsql took eight seconds. As
        always YMMV.

        Tony
        --
        Tony Toews, Microsoft Access MVP
        Please respond only in the newsgroups so that others can
        read the entire thread of messages.
        Microsoft Access Links, Hints, Tips & Accounting Systems at

        Comment

        Working...