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

Arthur Fuller fuller.artful at gmail.com
Thu Oct 13 19:41:03 CDT 2022


Thanks, Don,
I shall have a careful look at this and attempt to figure out how to make
it work with the second DB rather than the CurrentDB, but perhaps that
won't be so hard. Thanks to Stuart, I now know how to get the target db
(the one to analyze) open and susceptible to interrogation. This would be
so much easier if I were KGB and Access a person in a small room and
handcuffs.

On Thu, Oct 13, 2022 at 6:46 PM McGillivray, Don <DMcGillivray at ctc.ca.gov>
wrote:

> Hi Arthur,
>
> I just ran this within a database and got a list of all of the forms and
> reports in the container.  You should be able to aim this at your remote DB
> as the target just as well.  If you want to see the attributes (data
> source, controls, etc.) of the form/report, you'll need to open it first
> and then do operations on the open instance.  That can be done in code,
> too, once you have the object names from the container.  I don't think
> there's any way to see into a form or report except by opening it, but the
> containers object lets you get to the names of the reports and forms so
> they can be opened and interrogated.
>
> Function ShowMeTheFormsAndReports()
> Dim db As DAO.Database
> Dim doc As DAO.Document
>
> Set db = CurrentDb()
>
> For Each doc In db.Containers("forms").Documents
>
>     Debug.Print doc.Name
>
>     'To open the form:
>     DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
>     'do stuff with the open form
>     DoCmd.Close acForm, doc.Name, acSaveNo
> Next
>
> For Each doc In db.Containers("reports").Documents
>     'do stuff with reports
> Next
>
> Set db = Nothing
> End Function
>
> - Don
>
> -----Original Message-----
> From: AccessD <accessd-bounces+dmcgillivray=
> ctc.ca.gov at databaseadvisors.com> On Behalf Of Arthur Fuller
> Sent: Thursday, October 13, 2022 2:00 PM
> To: Access Developers discussion and problem solving <
> accessd at databaseadvisors.com>
> Subject: [AccessD] Call a function in an AccDb from outside it?
>
> 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://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdatabaseadvisors.com%2Fmailman%2Flistinfo%2Faccessd&data=05%7C01%7Cdmcgillivray%40ctc.ca.gov%7Cc3af3faf74c74775c32208daad5dfe64%7C78276a93cafd497081b54e5074e42910%7C0%7C0%7C638012916459722126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=SKCLQdhGUog%2Fb2v8aT0cLpzfixw6Fh6A6aN1UjFOxVg%3D&reserved=0
> Website:
> https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.databaseadvisors.com%2F&data=05%7C01%7Cdmcgillivray%40ctc.ca.gov%7Cc3af3faf74c74775c32208daad5dfe64%7C78276a93cafd497081b54e5074e42910%7C0%7C0%7C638012916459722126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=UUbLYPanNL6dBv3fc5yfpO6QrLr24Sat4Y%2B963Jy6c4%3D&reserved=0
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
Arthur


More information about the AccessD mailing list