jwcolby
jwcolby at colbyconsulting.com
Mon Jul 30 09:29:55 CDT 2007
I do but I don't have time to go find it. Basically forms which are not open are stored in a documents("forms") collection in the database. You have to get the NAME of each document (which will be the name of each form in the db), then use docmd.openform(ThatFormName) and set a parameter of that DoCmd to open it in design view. Once you have done that, then the form is open in the forms() collection so you can get a pointer to the form. With the form open you can get at the controls collection. I forget what object the documents is a part of. It could be the currentdb object, it could be the application object. Dim doc as document Dim frm as form Dim ctl as control For each doc in documents("forms") docmd.open acform, (doc.name),acDesignView set frm = forms(doc.name) for each ctl in frm.controls() next ctl Docmd.close acform, doc.name Next doc IOW, a form has to be OPEN (either in view mode or design view) to access the controls collection. You want to open it in design view. Once it is opened, get a pointer to it and then access the controls collection The code above is NOT working, but it is close (from memory) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Sad Der Sent: Monday, July 30, 2007 9:55 AM To: Acces User Group Subject: [AccessD] Get all controls on all forms Hi group, Does anybody have piece of code that retrieves all controles on all forms in a database? I need to store these in a database. Thnx! Regards, Sander ____________________________________________________________________________ ________ Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com