look here for TSI's SOON - Shut One Open New
http://www.trigeminal.com/lang/1033/...asp?ItemID=8#8
HS
"Mike Hinde" <(E-Mail Removed)> wrote in message
news:03c001c37dc1$48a8fba0$(E-Mail Removed)...
> Wondering if anyone can offer suggestions for overcoming a
> problem the code below is currently giving me?
>
> It's a simple little code to switch between 2 databases
> that appears to work fine (and indeed DOES work fine
> switching between 3 out of 5 databases) but when you start
> using forms in the newly opened database, clicking on
> forms/running certain bits of code causes Access to close
> down for no apparant reason.
>
> All databases work fine when opened individually - only
> when opened using this code do the problems occur.
>
> Any ideas as to what is going wrong/what I've done wrong
> would be most appreciated??
>
>
> *****************************************************
> Private Sub Box8_Click()
> Const strConPathToEMS = "C:\database.mdb"
> Dim appAccess As Access.Application
>
> 'Open another Access and the required database
> Set appAccess = CreateObject("Access.Application")
> appAccess.OpenCurrentDatabase strConPathToEMS
> appAccess.Visible = True
> appAccess.RunCommand acCmdAppMaximize
> appAccess.DoCmd.OpenForm "frmSwitchboard"
> appAccess.Forms("frmSwitchboard").SetFocus
> 'Close calling database
> DoCmd.Close acForm, Me.Name, acSaveNo
> DoCmd.Quit
> End Sub
> ***************************************************