Delete Query without the confimation prompts

Delete Query without the confimation prompts

am 12.04.2008 22:43:54 von Presto

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_Click()
On Error GoTo Err_cmdCloseForm_Click

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

DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.Close

Exit_cmdCloseForm_Click:
Exit Sub

Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click

End Sub
_______________________________________

Any help is deeply appreciated,

Presto

Re: Delete Query without the confimation prompts

am 12.04.2008 23:28:28 von fredg

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_Click()
> On Error GoTo Err_cmdCloseForm_Click
>
> ' This statement runs the query to delete all recordsfrom the
> temporary table tblCustomerID
>
> DoCmd.OpenQuery "qry_Lookup_DeleteCID"
> DoCmd.Close
>
> Exit_cmdCloseForm_Click:
> Exit Sub
>
> Err_cmdCloseForm_Click:
> MsgBox Err.Description
> Resume Exit_cmdCloseForm_Click
>
> End Sub
> _______________________________________
>
> Any help is deeply appreciated,
>
> Presto

Either....
Private Sub cmdCloseForm_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.SetWarnings True
DoCmd.Close
End Sub

or...

Private Sub cmdCloseForm_Click()
CurrrentDb.Execute "qry_Lookup_DeleteCID", dbFailOnError
DoCmd.Close
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Re: Delete Query without the confimation prompts

am 13.04.2008 03:09:05 von Presto

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" wrote in message
news:1e87ee321x21m.18acdgkgw48if.dlg@40tude.net...
> 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_Click()
>> On Error GoTo Err_cmdCloseForm_Click
>>
>> ' This statement runs the query to delete all recordsfrom the
>> temporary table tblCustomerID
>>
>> DoCmd.OpenQuery "qry_Lookup_DeleteCID"
>> DoCmd.Close
>>
>> Exit_cmdCloseForm_Click:
>> Exit Sub
>>
>> Err_cmdCloseForm_Click:
>> MsgBox Err.Description
>> Resume Exit_cmdCloseForm_Click
>>
>> End Sub
>> _______________________________________
>>
>> Any help is deeply appreciated,
>>
>> Presto
>
> Either....
> Private Sub cmdCloseForm_Click()
> DoCmd.SetWarnings False
> DoCmd.OpenQuery "qry_Lookup_DeleteCID"
> DoCmd.SetWarnings True
> DoCmd.Close
> End Sub
>
> or...
>
> Private Sub cmdCloseForm_Click()
> CurrrentDb.Execute "qry_Lookup_DeleteCID", dbFailOnError
> DoCmd.Close
> End Sub
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail