<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV>
<DIV><STRONG>Jeanine,</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV> You may also like to try on the following lines.</DIV>
<DIV> Let SourceDb and DestnDb be the string variables
representing full paths of source & destination databases. Desired sequence
of action - Close SourceDb, Open DestnDb, take desired action within
DestnDb, close DestnDb, return back to SourceDb. Two alternatives
could be considered -</DIV>
<DIV> </DIV>
<DIV> <U><STRONG>Case-1 -- Hard coding</STRONG></U></DIV>
<DIV> <U>(a) Exit Code in SourceDb -</U></DIV>
<DIV> Dim acp As
Access.Application <BR>
Set acp = New Access.Application<BR>
acp.Visible = True<BR>
acp.OpenCurrentDatabase DestnDb<BR>
Application.Quit acQuitSaveAll</DIV>
<DIV> </DIV>
<DIV> <U>(b) Code in startup form of DestnDb -</U></DIV>
<DIV> << Code for action in
DestnDb >></DIV>
<DIV> Dim acp As
Access.Application <BR>
Set acp = New Access.Application<BR>
acp.Visible = True<BR>
acp.OpenCurrentDatabase SourceDb<BR>
Application.Quit acQuitSaveAll</DIV>
<DIV> </DIV>
<DIV> <U><STRONG>Case-2 -- Flexible
Response</STRONG></U></DIV>
<DIV> (a) Create a table (named "T_Status") in SourceDb.It
will have two fields, both of text type - namely DbFullPath(full path
of source database) and Status("R" for return back to SourceDb, "S" for
stay put in DestnDb).Values need not be filled manually.</DIV>
<DIV> </DIV>
<DIV> <U>(b) Relevant command button in SourceDb would
have following code in its click event -</U></DIV>
<DIV> Dim rst1 As
ADODB.Recordset<BR> Dim FPT As
String, TBL As String</DIV>
<DIV> Dim DestnDb As
String, STS As String</DIV>
<DIV> Dim acp As
Access.Application<BR> <BR>
DestnDb = "<Put here full path of destination database>"</DIV>
<DIV> TBL = "T_Status"</DIV>
<DIV> STS = "R" '
R - for return back to Source Database, </DIV>
<DIV>'
S - for stay put in Destination
Database.<BR> FPT =
CurrentProject.FullName ' Gives Full Path</DIV>
<DIV><BR> Set rst1 = New
ADODB.Recordset<BR> Set
rst1.ActiveConnection =
CurrentProject.Connection<BR>
rst1.CursorType = adOpenKeyset<BR>
rst1.LockType = adLockOptimistic<BR>
rst1.Source = TBL<BR>
<BR> rst1.Open
options:=adCmdTable<BR> If
rst1.RecordCount > 0
Then<BR>
rst1.MoveFirst</DIV>
<DIV>
rst1.Fields("DbFullPath") = FPT</DIV>
<DIV>
rst1.Fields("Status") = STS<BR>
Else<BR>
rst1.AddNew<BR>
rst1.Fields("DbFullPath")
= FPT<BR>
rst1.Fields("Status") = STS<BR> End
If '
rst1.RecCount</DIV>
<DIV>
rst1.Update<BR> <BR>
DoCmd.TransferDatabase acExport, "Microsoft Access",
_<BR>
DestnDb, acTable, TBL,
TBL<BR>
<BR>
rst1.Close<BR> Set rst1 =
Nothing</DIV>
<DIV><BR> Set acp = New
Access.Application<BR> acp.Visible =
True<BR>
acp.OpenCurrentDatabase DestnDb<BR>
Application.Quit acQuitSaveAll</DIV>
<DIV> </DIV>
<DIV> <U>(c) Code in startup form of DestnDb -</U></DIV>
<DIV> << Code for action in
DestnDb >></DIV>
<DIV>
<DIV> Dim STS As String, FPT As
String</DIV>
<DIV> Dim acp As
Access.Application</DIV>
<DIV> STS = Nz(DLookup("Status",
"T_Status"), "")<BR> FPT =
Nz(DLookup("DbFullPath", "T_Status"), "")<BR>
If STS = "R" And Len(FPT) > 0
Then<BR> Set acp =
New Access.Application<BR>
acp.Visible =
True<BR>
acp.OpenCurrentDatabase FPT<BR>
Application.Quit
acQuitSaveAll<BR> End
If ' STS</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV><STRONG>A.D.Tejpal</STRONG></DIV>
<DIV><STRONG>--------------------------------</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV>----- Original Message ----- </DIV>
<DIV><B>From:</B> <A title=cfoust@infostatsystems.com
href="mailto:cfoust@infostatsystems.com">Charlotte Foust</A> </DIV>
<DIV><B>To:</B> <A title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV><B>Sent:</B> Friday, May 02, 2003 20:44</DIV>
<DIV><B>Subject:</B> RE: [AccessD] Close current database</DIV>
<DIV> </DIV>
<DIV> Take a look at the OpenCurrentDatabase method.
Both databases stay open but you switch to the new one.<BR><BR>Charlotte
Foust<BR></DIV></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>----- Original Message ----- </DIV>
<DIV><B>From:</B> <A title=stuart@lexacorp.com.pg
href="mailto:stuart@lexacorp.com.pg">Stuart McLachlan</A>
</DIV></BLOCKQUOTE></DIV></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=jscott@mchsi.com
href="mailto:jscott@mchsi.com">Jeanine</A> ; <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, May 02, 2003 18:38</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Close current
database</DIV>
<DIV><BR></DIV>
<DIV>On 2 May 2003 at 7:29, Jeanine wrote:<BR>> <BR>> I just can't get
the darn thing to close itself and open another db.<BR>> <BR>One way, of
the top of my head would be:<BR><BR>Public Declare Function ShellExecute Lib
"shell32.dll" Alias _<BR>"ShellExecuteA" (ByVal hwnd As Long, ByVal
lpOperation As String, _<BR>ByVal lpFile As String, ByVal lpParameters As
String, ByVal _<BR>lpDirectory As String, ByVal nShowCmd As Long) As Long
_<BR><BR>Sub
OpenTheOtherOne()<BR>ShellExecute(0,"Open","C:\Full\Path\To\YourSecondApp.mdb"","","",1)<BR>DoCmd.Quit<BR>End
Sub<BR><BR>Lexacorp Ltd<BR><A
href="http://www.lexacorp.com.pg">http://www.lexacorp.com.pg</A><BR>Information
Technology Consultancy, Software Development,System <BR>Support.</DIV>
<DIV><BR>-----Original Message-----<BR>From: Jeanine [mailto:jscott@mchsi.com]
<BR>Sent: Friday, May 02, 2003 4:30 AM<BR>To: <A
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A><BR>Subject:
[AccessD] Close current database<BR><BR>I am running into some problems with
something and I think I may just be<BR>making it too hard. I want to open one
database from another - close the<BR>first and run some code in the second.
Then close the second and open<BR>the first again.<BR><BR>I have messed around
with the open and close currentdb methods but they<BR>only seem to be for the
purpose of automation.<BR><BR>My objective is to check the current version
when my users open their<BR>application. If the version is not current the
routine will close the<BR>application and open a separate db that does the
copy routine. Then the<BR>copy db will close itself and re-open the
application. My theory is this<BR>will give the users a pretty seamless
version control system.<BR><BR>I just can't get the darn thing to close itself
and open another db.<BR><BR>Thanks!<BR></DIV></BLOCKQUOTE></BODY></HTML>