[AccessD] Call a function in an AccDb from outside it?
DMcGillivray at ctc.ca.gov
Thu Oct 13 17:46:46 CDT 2022
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.
Dim db As DAO.Database
Dim doc As DAO.Document
Set db = CurrentDb()
For Each doc In db.Containers("forms").Documents
'To open the form:
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
'do stuff with the open form
DoCmd.Close acForm, doc.Name, acSaveNo
For Each doc In db.Containers("reports").Documents
'do stuff with reports
Set db = Nothing
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?
AccessD mailing list
AccessD at databaseadvisors.com
More information about the AccessD