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 2 / May 2007

Tip: Looking for answers? Try searching our database.

Do I need to pause this script?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff C - 21 May 2007 14:55 GMT
This database is set up so that when I open it up, a form loads that has
about 12 sequenced events that run one after the other to update the data
every day.

I want to run the following script:

Option Explicit

Dim oJet       'As DAO.DBEngine
Dim oDB        'As DAO.Database

Const DB_NAME = "FullPathToDatabase.mdb"

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase(DB_NAME)

oDB.Close

Is there anything I need to use to pause between the Opendatabase and
oDB.Close to allow the events enough time to run?  Are there any opinions
about doing this?

Thank you
Signature

Jeff C
Live Well .. Be Happy In All You Do

Roger Carlson - 21 May 2007 16:09 GMT
If you intend for this to open the other Access application, open a form,
and run events, you'll be disappointed.  OpenDatabase ONLY opens the
database, not the Access database application.  There is a difference.  In
order to do what you want, you could use the Shell command to open the
Access database file with the /x switch.  This will execute a macro which
could contain all your commands or just run a function that executes all
your command. Then at the bottom of you code, (in the remote database) you
close the application.

Something like this:
Set db = CurrentDb

Filename = "\RemoteMacro.mdb"
ExecutionMacro = " /xAutoRun"
'the directory where the application lives
Directory = getpath(db.Name)
'finds where Access itself lives
AppPath = SysCmd(acSysCmdAccessDir) & "MSACCESS.EXE"
'MsgBox AppPath & " " & Directory & Filename
htask = Shell(AppPath & " " & Directory & Filename & ExecutionMacro, 1)

This code will open the external database, excuting the AutoRun macro.  This
macro calls some code then quits.

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "RunRemoteMacro.mdb" which illustrates how to do this.

Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

> This database is set up so that when I open it up, a form loads that has
> about 12 sequenced events that run one after the other to update the data
[quoted text clipped - 19 lines]
>
> Thank you
Jeff C - 21 May 2007 17:13 GMT
Thank you Roger, I'll look at your example and try to get this working, I'll
post back with questions.  I appreciate your help.
Signature

Jeff C
Live Well .. Be Happy In All You Do

> If you intend for this to open the other Access application, open a form,
> and run events, you'll be disappointed.  OpenDatabase ONLY opens the
[quoted text clipped - 46 lines]
> >
> > Thank you
dbahooker@hotmail.com - 21 May 2007 18:25 GMT
you don't need to pause it

but you do need to change it to ADO

I mean get with the times kids

> This database is set up so that when I open it up, a form loads that has
> about 12 sequenced events that run one after the other to update the data
[quoted text clipped - 22 lines]
> Jeff C
> Live Well .. Be Happy In All You Do
 
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.