[AccessD] Call a function in an AccDb from outside it?

Stuart McLachlan stuart at lexacorp.com.pg
Thu Oct 13 17:04:06 CDT 2022


Don't know if it's any use to you,
but here's something that may get you started on your desired path.
It lets you open a second database and manipulate it:

Function OpenForm(DB As String, frm As String) As Long
 Dim strDB As String
 strDB = CurrentProject.Path & "\" & DB
 Dim appSecondInstance As New Access.Application
 With appSecondInstance
    .Visible = True
    .UserControl = True
    .OpenCurrentDatabase strDB
    .DoCmd.OpenForm frm, acNormal
 End With
End Function



On 14 Oct 2022 at 7:50, Stuart McLachlan wrote:

> About the only way I can think of would be to iterate through
> msysObjects, that will at least give you the names of all the
> forms,reports and modules.
> 
> A lot depends on what you mean by "process its forms".
> "Processing" them would be a very different matter since they are
> actually different objects embedded in the accdb  not a part of the
> data engine - you can't access them through DAO's OpenDatabase.
> 
> An Access .accdb is essentially two sepearate pieces:
> 1. A  relational database management system (tables and queries)
> 2. An application consisting of various types of objects (windows
> forms, reports, controls, and compiled code) which connect to the
> RDBMS.
> 
> 
> On 13 Oct 2022 at 17:00, Arthur Fuller wrote:
> 
> > I'm still working on my problem of opening an AccDb within a running
> > one. Thanks to Stuart, I now have that part working beautifully. But
> > as they say, inside every beautiful solution lurks a monster ready
> > to bite you.
> > 
> > So I've got my utility able to browse for a database to open, then
> > list its TableDefs and QueryDefs. I want to move on to be able to
> > process its forms, but I can't get at AllForms. Is there any way to
> > do this?
> > 
> > Failing that, I thought that maybe I could write a function inside
> > the "target" db (the one opened within my utility) and maybe call it
> > from the utility DB? Is that possible?
> > 
> > -- 
> > Arthur
> > -- 
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list