Close Database

  • Thread starter Thread starter Bob Flenniken
  • Start date Start date
B

Bob Flenniken

-----Original Message-----
Help, I am trying to find a way to close a small database
using VBA. Thank you!
.

Put this code on an Exit button on the last form open. The
first line will close the form. The second line will close
the application and Access.

DoCmd.Close acForm, Me.Name
DoCmd.Quit
 
Bob, thanks for info. I cannot use code linked to an
event nor can I use a macro. Here is what I am ultimately
trying to achieve and I just cannot find a way to do it.
My thought was to create a function or module (I am not
sure of the correct terminology) that I can call by a
hyperlink on my form.

My goal:

I have several labels on a form which I want to link to
events -- for example, when the user clicks on the label
text, it will close the database. This is easy enough by
using docmd.quit, however I want the label to
appear "hyperlink-like" so that when the user runs the
mouse pointer over the text on the label the pointer will
change to a hand (like it does when you use a hyperlink).
I am able to do this by setting the properties of the
label to hyperlink for opening objects such as forms,
however I cannot figure out a way to achieve this with
other commands such as quitting the database.
 
Thank you all for info. I set the link to the form name
and achieved the results by setting event to close. Thanks
to all of you who go out of your way to help those in need!
 
Back
Top