prevent Access from asking some confirmations (by code) 
Author Message
 prevent Access from asking some confirmations (by code)

Hi !

I can't remember what's the command to use before a delete command (for
example) to prevent MS Access asking the user if he is sure, what can be
confusing...

That's in a form, when exiting in some cases I run the following code :

DoCmd.RunCommand (acCmdDeleteRecord)

I don't want to uncheck any general options that would prevent Access
from asking ANY confirmations...  In only want it to not ask that in this
particular case.

I searched in MSDN but couldn't find the name of the method or property
to use...

Thanks for your help or any pointer !
Olivier



Fri, 19 Sep 2003 23:10:07 GMT  
 prevent Access from asking some confirmations (by code)
docmd.setwarnings false

do your things

docmd.setwarnings true

cheers,

Tom

Quote:

> Hi !

> I can't remember what's the command to use before a delete command (for
> example) to prevent MS Access asking the user if he is sure, what can be
> confusing...

> That's in a form, when exiting in some cases I run the following code :

> DoCmd.RunCommand (acCmdDeleteRecord)

> I don't want to uncheck any general options that would prevent Access
> from asking ANY confirmations...  In only want it to not ask that in this
> particular case.

> I searched in MSDN but couldn't find the name of the method or property
> to use...

> Thanks for your help or any pointer !
> Olivier

--
      Tom Tavernier        +32-9-2448992

Tele Atlas - The reference in digital mapping
          http://www.teleatlas.com


Fri, 19 Sep 2003 23:15:09 GMT  
 prevent Access from asking some confirmations (by code)
If Not Me.NewRecord Then
  With Me.RecordsetClone
    .Bookmark = Me.Bookmark
    .Delete
  End With
End If

Quote:

> Hi !

> I can't remember what's the command to use before a delete command (for
> example) to prevent MS Access asking the user if he is sure, what can be
> confusing...

> That's in a form, when exiting in some cases I run the following code :

> DoCmd.RunCommand (acCmdDeleteRecord)

> I don't want to uncheck any general options that would prevent Access
> from asking ANY confirmations...  In only want it to not ask that in this
> particular case.

> I searched in MSDN but couldn't find the name of the method or property
> to use...

> Thanks for your help or any pointer !
> Olivier

--
Perth, Western Australia
Tips for MS Access users at:
        http://odyssey.apana.org.au/~abrowne


Sat, 20 Sep 2003 10:13:32 GMT  
 prevent Access from asking some confirmations (by code)
Tom Tavernier said...

Quote:
> docmd.setwarnings false

> do your things

> docmd.setwarnings true

> cheers,

> Tom


> > Hi !

> > I can't remember what's the command to use before a delete command (for
> > example) to prevent MS Access asking the user if he is sure, what can be
> > confusing...

> > That's in a form, when exiting in some cases I run the following code :

> > DoCmd.RunCommand (acCmdDeleteRecord)

> > I don't want to uncheck any general options that would prevent Access
> > from asking ANY confirmations...  In only want it to not ask that in this
> > particular case.

> > I searched in MSDN but couldn't find the name of the method or property
> > to use...

> > Thanks for your help or any pointer !
> > Olivier

> --
>       Tom Tavernier        +32-9-2448992

> Tele Atlas - The reference in digital mapping
>           http://www.teleatlas.com

yep, that's what I was looking for !

Thanks



Sat, 20 Sep 2003 15:55:45 GMT  
 prevent Access from asking some confirmations (by code)
Allen Browne said...

Quote:
> If Not Me.NewRecord Then
>   With Me.RecordsetClone
>     .Bookmark = Me.Bookmark
>     .Delete
>   End With
> End If

Mh, that's a solution I didn't think of, I suppose that it's equivalent
to the Docmd.runcommand method...


Sat, 20 Sep 2003 16:01:25 GMT  
 prevent Access from asking some confirmations (by code)
It's very close to the same thing: just a touch more reliable, as
it makes no assumptions about which form is active.

RunCommand deletes from the Active form. In the worst case scenario,
something like a timer event could cause the focus to change and a
record to then be deleted from the wrong form without warning.

A side issue is that this code gives no warning regardless of the
SetWarnings state, which seemed to suit your purposes.

Quote:

> Allen Browne said...

> > If Not Me.NewRecord Then
> >   With Me.RecordsetClone
> >     .Bookmark = Me.Bookmark
> >     .Delete
> >   End With
> > End If

> Mh, that's a solution I didn't think of, I suppose that it's equivalent
> to the Docmd.runcommand method...

--
Perth, Western Australia
Tips for MS Access users at:
        http://odyssey.apana.org.au/~abrowne


Sat, 20 Sep 2003 16:24:25 GMT  
 prevent Access from asking some confirmations (by code)
Allen Browne said...

Quote:
> It's very close to the same thing: just a touch more reliable, as
> it makes no assumptions about which form is active.

> RunCommand deletes from the Active form. In the worst case scenario,
> something like a timer event could cause the focus to change and a
> record to then be deleted from the wrong form without warning.

> A side issue is that this code gives no warning regardless of the
> SetWarnings state, which seemed to suit your purposes.

ok, you convinced me ;-)
I'll use this one.

Thanks for your help !
Olivier



Mon, 22 Sep 2003 16:07:40 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. preventing user access to code of a macro

2. Prevent Word to ask for saving global template

3. Turning Off Confirmations from code

4. [newbie to VB asks about Query object/SQL code pro/con]

5. Ask for DCOM sample source code

6. Graham Mandeno's code to prevent multiple instances

7. Code to prevent debug popup

8. Prevent Duplicates when updating with code or append

9. Prevent user to edit VBA code

10. How to prevent user to see vba source code

11. Option Strict On disallows late binding which prevents my code from compiling

12. Preventing automatic code-behind

 

 
Powered by phpBB® Forum Software