Delete Query without the confimation prompts

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

    Delete Query without the confimation prompts

    I have form with a Close button. When the button is closed, I want it to
    first delete all records in tblCustomerID then close the form.
    I would like the delete query to just run and not prompt me over and over
    and over to confirm because I WANT to DELETE them.
    If it's better to run it as SQL code and not a separate query, that's cool,
    but I have no idea how to do this.

    Heres the code behind the OnClick event:

    Private Sub cmdCloseForm_Cl ick()
    On Error GoTo Err_cmdCloseFor m_Click

    ' This statement runs the query to delete all recordsfrom the
    temporary table tblCustomerID

    DoCmd.OpenQuery "qry_Lookup_Del eteCID"
    DoCmd.Close

    Exit_cmdCloseFo rm_Click:
    Exit Sub

    Err_cmdCloseFor m_Click:
    MsgBox Err.Description
    Resume Exit_cmdCloseFo rm_Click

    End Sub
    _______________ _______________ _________

    Any help is deeply appreciated,

    Presto


  • fredg

    #2
    Re: Delete Query without the confimation prompts

    On Sat, 12 Apr 2008 16:43:54 -0400, Presto wrote:
    I have form with a Close button. When the button is closed, I want it to
    first delete all records in tblCustomerID then close the form.
    I would like the delete query to just run and not prompt me over and over
    and over to confirm because I WANT to DELETE them.
    If it's better to run it as SQL code and not a separate query, that's cool,
    but I have no idea how to do this.
    >
    Heres the code behind the OnClick event:
    >
    Private Sub cmdCloseForm_Cl ick()
    On Error GoTo Err_cmdCloseFor m_Click
    >
    ' This statement runs the query to delete all recordsfrom the
    temporary table tblCustomerID
    >
    DoCmd.OpenQuery "qry_Lookup_Del eteCID"
    DoCmd.Close
    >
    Exit_cmdCloseFo rm_Click:
    Exit Sub
    >
    Err_cmdCloseFor m_Click:
    MsgBox Err.Description
    Resume Exit_cmdCloseFo rm_Click
    >
    End Sub
    _______________ _______________ _________
    >
    Any help is deeply appreciated,
    >
    Presto
    Either....
    Private Sub cmdCloseForm_Cl ick()
    DoCmd.SetWarnin gs False
    DoCmd.OpenQuery "qry_Lookup_Del eteCID"
    DoCmd.SetWarnin gs True
    DoCmd.Close
    End Sub

    or...

    Private Sub cmdCloseForm_Cl ick()
    CurrrentDb.Exec ute "qry_Lookup_Del eteCID", dbFailOnError
    DoCmd.Close
    End Sub
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail

    Comment

    • Presto

      #3
      Re: Delete Query without the confimation prompts

      Thank you Fredg! It works beautifully.
      I just wish the Help that comes with Access would be a little more
      intuitive.
      In the VB editor I searched for this and it only showed the process to stop
      ALL confirmations - which I don't want to do.


      "fredg" <fgutkind@examp le.invalidwrote in message
      news:1e87ee321x 21m.18acdgkgw48 if.dlg@40tude.n et...
      On Sat, 12 Apr 2008 16:43:54 -0400, Presto wrote:
      >
      >I have form with a Close button. When the button is closed, I want it to
      >first delete all records in tblCustomerID then close the form.
      >I would like the delete query to just run and not prompt me over and over
      >and over to confirm because I WANT to DELETE them.
      >If it's better to run it as SQL code and not a separate query, that's
      >cool,
      >but I have no idea how to do this.
      >>
      >Heres the code behind the OnClick event:
      >>
      >Private Sub cmdCloseForm_Cl ick()
      >On Error GoTo Err_cmdCloseFor m_Click
      >>
      > ' This statement runs the query to delete all recordsfrom the
      >temporary table tblCustomerID
      >>
      > DoCmd.OpenQuery "qry_Lookup_Del eteCID"
      > DoCmd.Close
      >>
      >Exit_cmdCloseF orm_Click:
      > Exit Sub
      >>
      >Err_cmdCloseFo rm_Click:
      > MsgBox Err.Description
      > Resume Exit_cmdCloseFo rm_Click
      >>
      >End Sub
      >______________ _______________ __________
      >>
      >Any help is deeply appreciated,
      >>
      >Presto
      >
      Either....
      Private Sub cmdCloseForm_Cl ick()
      DoCmd.SetWarnin gs False
      DoCmd.OpenQuery "qry_Lookup_Del eteCID"
      DoCmd.SetWarnin gs True
      DoCmd.Close
      End Sub
      >
      or...
      >
      Private Sub cmdCloseForm_Cl ick()
      CurrrentDb.Exec ute "qry_Lookup_Del eteCID", dbFailOnError
      DoCmd.Close
      End Sub
      --
      Fred
      Please respond only to this newsgroup.
      I do not reply to personal e-mail

      Comment

      Working...