prevent save when closing a form

  • Follow


Hi,
access 2003:
I make a form on the fly with the createForm function.
when the user closes the application  I do not want this form to be saved.
Is there a way to prevent the save form dialog for unsaved forms when 
closing the application?

regards Rob
0
Reply Utf 6/1/2007 6:24:00 AM

"R.Warning" <RWarning@discussions.microsoft.com> wrote in message 
news:F558744A-4217-4D7C-9DCF-CA77A4DC686D@microsoft.com...
> Hi,
> access 2003:
> I make a form on the fly with the createForm function.
> when the user closes the application  I do not want this form to be saved.
> Is there a way to prevent the save form dialog for unsaved forms when
> closing the application?
>
> regards Rob

Can you close the form explicitly with DoCmd.Close and use acSaveNo in the 
Save As parameter?

    DoCmd.Close acForm, "my form", acSaveNo

Carl Rapson


0
Reply Carl 6/1/2007 3:00:44 PM


Hi Carl,

the close command acsaveNo isnot working when you close the application
for the "normal closing " off the form (ie. the application stays running.) 
it works fine.

"Carl Rapson" wrote:

> "R.Warning" <RWarning@discussions.microsoft.com> wrote in message 
> news:F558744A-4217-4D7C-9DCF-CA77A4DC686D@microsoft.com...
> > Hi,
> > access 2003:
> > I make a form on the fly with the createForm function.
> > when the user closes the application  I do not want this form to be saved.
> > Is there a way to prevent the save form dialog for unsaved forms when
> > closing the application?
> >
> > regards Rob
> 
> Can you close the form explicitly with DoCmd.Close and use acSaveNo in the 
> Save As parameter?
> 
>     DoCmd.Close acForm, "my form", acSaveNo
> 
> Carl Rapson
> 
> 
> 
0
Reply Utf 6/4/2007 7:53:01 AM

I found out myself.

first follow the directives in http://support.microsoft.com/kb/300688/en-us 
to disable the close and exit functions.

then add a menu item that points to a macro.
in that macro point to a function that closes all forms with the nosave 
option and than call 'Application.Quit acQuitSaveNone"

like this:
Public Function closeall()
Dim frm As Form

For Each frm In Application.Forms
    DoCmd.Close acForm, frm.name, acSaveNo
Next

Application.Quit acQuitSaveNone

End Function


"R.Warning" wrote:

> Hi Carl,
> 
> the close command acsaveNo isnot working when you close the application
> for the "normal closing " off the form (ie. the application stays running.) 
> it works fine.
> 
> "Carl Rapson" wrote:
> 
> > "R.Warning" <RWarning@discussions.microsoft.com> wrote in message 
> > news:F558744A-4217-4D7C-9DCF-CA77A4DC686D@microsoft.com...
> > > Hi,
> > > access 2003:
> > > I make a form on the fly with the createForm function.
> > > when the user closes the application  I do not want this form to be saved.
> > > Is there a way to prevent the save form dialog for unsaved forms when
> > > closing the application?
> > >
> > > regards Rob
> > 
> > Can you close the form explicitly with DoCmd.Close and use acSaveNo in the 
> > Save As parameter?
> > 
> >     DoCmd.Close acForm, "my form", acSaveNo
> > 
> > Carl Rapson
> > 
> > 
> > 
0
Reply Utf 6/5/2007 6:43:00 AM

3 Replies
836 Views

(page loaded in 0.07 seconds)


Reply: