I have the following code to open a second A2000 mdb. It opens the second
mdb Ok but it the second app alos closes immediately. What do I need to do
to hold the second mdb open while work in it?
Public Sub OpenAddIn()
Dim strDB As String, ThisDir As String
Dim appAccess As Object
ThisDir = DLookup("[XMLRequestResponseFilePath]", "tPreferences")
strDB = ThisDir & "\" & "AddInOne.mdb "
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True
appAccess.RunCommand acCmdAppMaximize
appAccess.Quit
Set appAccess = Nothing
End Sub
altacct@yahoo.com - 08 Nov 2004 17:36 GMT
Karl,
appAccess.Quit
closes the database. Get rid of that line.
Jeremy
> I have the following code to open a second A2000 mdb. It opens the second
> mdb Ok but it the second app alos closes immediately. What do I need to do
[quoted text clipped - 16 lines]
>
> End Sub
Karl Irvin - 08 Nov 2004 17:45 GMT
> Karl,
>
[quoted text clipped - 3 lines]
>
> Jeremy
I got rid of that line and it still opens and immediately closes.
> > I have the following code to open a second A2000 mdb. It opens the
> second
[quoted text clipped - 18 lines]
> >
> > End Sub
Rick Brandt - 08 Nov 2004 19:10 GMT
> I have the following code to open a second A2000 mdb. It opens the second
> mdb Ok but it the second app alos closes immediately. What do I need to do
[quoted text clipped - 16 lines]
>
> End Sub
If you dim the Access object within the sub-routine then it goes out of
focus (and closes) as soon as the routine is finished. To avoid that you
need to dim the object variable outside your procedure.

Signature
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Rick Brandt - 08 Nov 2004 19:28 GMT
> If you dim the Access object within the sub-routine then it goes out of
> focus (and closes) as soon as the routine is finished. To avoid that you
> need to dim the object variable outside your procedure.
DOH!
The word "focus" above should have been "scope".

Signature
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Karl Irvin - 08 Nov 2004 19:34 GMT
Rick
I dimmed as you indiated and it now works.
Thanks
-
> > If you dim the Access object within the sub-routine then it goes out of
> > focus (and closes) as soon as the routine is finished. To avoid that you
[quoted text clipped - 3 lines]
>
> The word "focus" above should have been "scope".