A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open Database with hyperlink. Close the current one



 
 
Thread Tools Display Modes
  #1  
Old July 14th, 2009, 04:06 PM posted to microsoft.public.access
Mark909
external usenet poster
 
Posts: 90
Default Open Database with hyperlink. Close the current one

Ive got a form set up in a database with a label hyperlinked to open up
another database when clicked.

Is it possible to make it so that the current database closes when the new
one opens
  #2  
Old July 14th, 2009, 04:16 PM posted to microsoft.public.access
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default Open Database with hyperlink. Close the current one

Private Sub ButtonName_Click()
Call Shell(Path to other database, 1)
DoCmd.Quit
End Sub

eg

Private Sub ButtonName_Click()
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\MyDocuments\MyDatabase..mdb", 1)
DoCmd.Quit
End Sub


--
Wayne
Manchester, England.



"mark909" wrote:

Ive got a form set up in a database with a label hyperlinked to open up
another database when clicked.

Is it possible to make it so that the current database closes when the new
one opens

  #3  
Old July 14th, 2009, 04:22 PM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Open Database with hyperlink. Close the current one

"mark909" wrote in message
...
Ive got a form set up in a database with a label hyperlinked to open up
another database when clicked.

Is it possible to make it so that the current database closes when the new
one opens



You can't do this with a hyperlink. You could have an autoexec macro (or
startup code) in the newly opened database automatically locate and close
the application window that had the previous database open.

Or (better, to my way of thinking) you could use code like this in the first
database to open the new database and close the current one:

'----- start of example code -----
Private Sub cmdSwapDB_Click()

Dim strNewDatabase As String

strNewDatabase = "C:\Users\Mark\Documents\NewDB.mdb"

Shell "msaccess.exe " & Chr(34) & strNewDatabase & Chr(34),
vbNormalFocus

DoCmd.Quit acQuitSaveNone

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.