cricketbird
Registered User.
- Local time
 - Today, 04:53
 
- Joined
 - Jun 17, 2013
 
- Messages
 - 124
 
I am trying to code a button that will quit the current Access database (A) and open another Access database (B). I can open database B just fine, but the quit command seems to close B instead of A. Database A knows where B is (so I can open it specifically), but B does not know where A is (unless I can pass that through in some way), so I can't hard-code that in the same way.
How can I quit A and open B?
Button Code from Database A:
	
	
	
		
 How can I quit A and open B?
Button Code from Database A:
		Code:
	
	
	dim destDB as string
destDB = "J:/path/to/database/B/"
Dim objAccess As Object
Set objAccess = GetObject(destDB) 'opens other db
'None of these work (they all seem to take action in Database B, not A, even if called from A).
    ' Me.Visible = True
    'CurrentDb.Close
    'DoCmd.Close
    'DoCmd.Quit