[AccessD] Call a function in an AccDb from outside it?
McGillivray, Don
DMcGillivray at ctc.ca.gov
Thu Oct 13 17:46:46 CDT 2022
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
More information about the AccessD
mailing list