PC Review


Reply
Thread Tools Rate Thread

Access Close Code

 
 
Gerry
Guest
Posts: n/a
 
      16th Jun 2004
Is there a way to either deactivate or else add code to
the close button in Access XP

My end users are closing the database by using the close
button for Access instead of using the custom command
button I have created. When they use the close button
maintanence code does not run.

Any guidance would be appreciated.

Thanks
 
Reply With Quote
 
 
 
 
Wayne Morgan
Guest
Posts: n/a
 
      16th Jun 2004
When you open Access, open a hidden form. In the Unload event of this form,
check for the value of a global "flag" variable you have created. If the
value isn't what was expected, set Cancel = True to cancel closing this
form. You may even want to pop-up a message box explaining the problem. When
you close the form the way you desire, set the value of the variable so that
the Cancel isn't triggered.

--
Wayne Morgan
Microsoft Access MVP


"Gerry" <(E-Mail Removed)> wrote in message
news:1d0b501c453bf$09240130$(E-Mail Removed)...
> Is there a way to either deactivate or else add code to
> the close button in Access XP
>
> My end users are closing the database by using the close
> button for Access instead of using the custom command
> button I have created. When they use the close button
> maintanence code does not run.
>
> Any guidance would be appreciated.
>
> Thanks



 
Reply With Quote
 
Gerry
Guest
Posts: n/a
 
      17th Jun 2004
Excellent, thanks Wayne.
>-----Original Message-----
>When you open Access, open a hidden form. In the Unload

event of this form,
>check for the value of a global "flag" variable you have

created. If the
>value isn't what was expected, set Cancel = True to

cancel closing this
>form. You may even want to pop-up a message box

explaining the problem. When
>you close the form the way you desire, set the value of

the variable so that
>the Cancel isn't triggered.
>
>--
>Wayne Morgan
>Microsoft Access MVP
>
>
>"Gerry" <(E-Mail Removed)> wrote in

message
>news:1d0b501c453bf$09240130$(E-Mail Removed)...
>> Is there a way to either deactivate or else add code to
>> the close button in Access XP
>>
>> My end users are closing the database by using the

close
>> button for Access instead of using the custom command
>> button I have created. When they use the close button
>> maintanence code does not run.
>>
>> Any guidance would be appreciated.
>>
>> Thanks

>
>
>.
>

 
Reply With Quote
 
tom
Guest
Posts: n/a
 
      18th Jun 2004
Or, Just have this hidden form actually DO the maintenance you want to
accomplish. That way, the maintenance code runs whichever way the user
closes Access.

-Tom

"Wayne Morgan" <(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> When you open Access, open a hidden form. In the Unload event of this form,
> check for the value of a global "flag" variable you have created. If the
> value isn't what was expected, set Cancel = True to cancel closing this
> form. You may even want to pop-up a message box explaining the problem. When
> you close the form the way you desire, set the value of the variable so that
> the Cancel isn't triggered.
>
> --
> Wayne Morgan
> Microsoft Access MVP
>
>
> "Gerry" <(E-Mail Removed)> wrote in message
> news:1d0b501c453bf$09240130$(E-Mail Removed)...
> > Is there a way to either deactivate or else add code to
> > the close button in Access XP
> >
> > My end users are closing the database by using the close
> > button for Access instead of using the custom command
> > button I have created. When they use the close button
> > maintanence code does not run.
> >
> > Any guidance would be appreciated.
> >
> > Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close Outlook from Access VBA code Marco Microsoft Access Form Coding 2 11th Sep 2008 12:38 PM
RE: How can I close access in vba code? Klatuu Microsoft Access VBA Modules 5 24th May 2008 01:34 PM
Code to close a form Access 2000 Suki Microsoft Access Getting Started 1 13th May 2004 06:52 PM
This code close access and display this message 1aae Microsoft Access Form Coding 1 4th Apr 2004 06:09 PM
Q: Code to open a program, then close access works ok, -but.. Jim Microsoft Access Form Coding 1 27th Nov 2003 12:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:12 PM.