Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

Automation question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karl Irvin - 08 Nov 2004 17:24 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
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".
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.