[AccessD] Contralling a second mdb from the first mdb

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Wed Mar 9 13:13:23 CST 2005


That will work!  Thank you.

Rocky

----- Original Message ----- 
From: "A.D.Tejpal" <adtp at touchtelindia.net>
To: "Access Developers discussion and problem solving" 
<accessd at databaseadvisors.com>
Sent: Wednesday, March 09, 2005 10:56 AM
Subject: Re: [AccessD] Contralling a second mdb from the first mdb


Rocky,

    The sub-routine given below should be able to get you the desired 
results. No need to set up any library reference to the remote db.

    The procedure will carry out background printing of target report 
located in the remote db. The user will not face any distraction as the 
remote db remains hidden throughout the process and is closed automatically 
after the report gets extracted.

Best wishes,
A.D.Tejpal
--------------

====================================
Private Sub P_OpenReportInRemoteDb(ByVal _
                                RepName As String, ByVal _
                                RemoteDbPath As String)
    Dim acp As Access.Application

    ' Create new instance of Access
    ' (This will remain hidden unless its visible property
    '   is set to True)
    Set acp = New Access.Application
    With acp
        .OpenCurrentDatabase RemoteDbPath
        .DoCmd.OpenReport RepName
        .Quit acQuitSaveAll
    End With
    Set acp = Nothing
End Sub
====================================

  ----- Original Message ----- 
  From: MartyConnelly
  To: Access Developers discussion and problem solving
  Sent: Monday, March 07, 2005 11:07
  Subject: Re: [AccessD] Contralling a second mdb from the first mdb


  Do you have a reference set to C:\Acessdat\xReports.mdb
  But this is where you may come a cropper on deployment,  because the 
reference may not be correct. and cannot be modified in an mde
  It will search the library mdb first for the name.of the report
  also this command  must execute from within  a subroutine in the library 
mdb that has the report and you can call the
  subroutine name from the main mdb.

  DoCmd.OpenReport "rptEvictionCase-MemoToSet", acViewPreview

  Rocky Smolin - Beach Access Software wrote:

  > Trying to run a report in a second database from the first database I
  > tried
  >
  > DoCmd.OpenReport
  > "C:\Acessdat\xReports.Reports!rptEvictionCase-MemoToSet", acViewPreview
  >
  >
  > Where xReports is the name of the mdb with the report I'm trying to
  > run from an mdb called Forms.mdb, but the syntax is incorrect.
  >
  > Does anyone know the correct syntax?
  >
  > MTIA
  >
  > Rocky Smolin
  > Beach Access Software
  > http://www.e-z-mrp.com
  > 858-259-4334
  > ----- Original Message ----- From: "Rocky Smolin - Beach Access
  > Software" <bchacc at san.rr.com>
  > To: "Access Developers discussion and problem solving"
  > <accessd at databaseadvisors.com>
  > Sent: Saturday, March 05, 2005 5:11 PM
  > Subject: Re: [AccessD] Contralling a second mdb from the first mdb
  >
  >
  >> Marty:
  >>
  >> So far the code is:
  >>
  >>    DoCmd.RunSQL "DELETE from C:\Acessdat\Reports.tUDGlobalMerge"
  >>    DoCmd.RunSQL "INSERT INTO tUDGlobalMerge " & _
  >>                 "IN 'C:\ACESSDAT\Reports.mdb' " & _
  >>                 "SELECT tUDGlobalMerge.* " & _
  >>                 "FROM tUDGlobalMerge"
  >>
  >>
  >> This code is run from a database named Forms.mdb
  >> It deletes all the records in a table tUDGlobalMerge in the database
  >> named Reports.
  >>
  >> It then copies all the data from the table named tUDGlobalMerge in
  >> Forms.mdb to the table tUDGlobalMerge in Reports.mdb.  Where it can
  >> then be run.
  >>
  >> What client wants now is, from the database Forms.mdb, open
  >> Reports.mdb hidden (so it doesn't show in the screen), print Report
  >> and close Reports.mdb.
  >>
  >> Can it be done with DoCmd.OpenReport specifying the report as the
  >> database and report name in the reports collection?
  >>
  >> TIA
  >>
  >> Rocky Smolin
  >> Beach Access Software
  >> http://www.e-z-mrp.com
  >> 858-259-4334
  >>
  >>
  >> ----- Original Message ----- From: "MartyConnelly"
  >> <martyconnelly at shaw.ca>
  >> To: "Access Developers discussion and problem solving"
  >> <accessd at databaseadvisors.com>
  >> Sent: Saturday, March 05, 2005 2:17 PM
  >> Subject: Re: [AccessD] Contralling a second mdb from the first mdb
  >>
  >>
  >>> I know of two ways but this depends on program flow, you are running
  >>> from one or the other mdb
  >>> 1. Use an MDA but I don't know all the ramifications of using an
  >>> MDA, there are exceptions like circular references
  >>>  See MDH Developers Handbook on Developing wizards
  >>>  or
  >>> http://www.vb123.com/toolshed/00_Docs/buildwizards.htm
  >>>
  >>> 2. TSI SOON from Michael Kaplan (Shut One, Open New)  requires a DLL
  >>> and VB6 runtime
  >>>
  >>> Rocky Smolin - Beach Access Software wrote:
  >>>
  >>>> Dear List:
  >>>>
  >>>> Can you control all of the functions of a second mdb from the first
  >>>> mdb - start, open forms, run reports, etc.?
  >>>>
  >>>> TIA
  >>>>
  >>>> Rocky Smolin
  >>>> Beach Access Software
  >>>> http://www.e-z-mrp.com
  >>>> 858-259-4334

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list