program the close Access button on the upper right hand corner of the screen

P

Philip Leduc

How to I connect an event to the close Access button (white X on red square)
..
The idea is when the user clicks this he will get a warning with the option
to cancel before Access closes out completely
 
A

Arvin Meyer [MVP]

You can't. But what you can do is to program a hidden form to cancel the
event and give the user a message that he must close the form through your
interface. Be careful to make sure the user understands why because irrate
users can do significant damage to the database should they decide to just
turn off the machine.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
G

Guest

Hi Philip,

I'm not sure what the "white X on red square" means, but you can use code
similar to this behind a command button:


Private Sub cmdQuit_Click()
On Error GoTo ProcError

Dim intResponse As Integer

intResponse = MsgBox("Do you wish to quit this application?", _
vbQuestion + vbYesNo, "Please Confirm Intent to Quit...")

If intResponse = vbYes Then
DoCmd.Quit
End If

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdQuit_Click event procedure..."
Resume ExitProc
End Sub



Tom Wickerath, Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top