Charlotte Foust
cfoust at infostatsystems.com
Tue Jan 20 10:42:20 CST 2004
Maybe JC knows differently, but as far as I know, you can't do it that way, which is one of the reasons I don't use that syntax. Charlotte Foust -----Original Message----- From: Ken Ismert [mailto:KIsmert at TexasSystems.com] Sent: Tuesday, January 20, 2004 8:33 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Instantiate Forms as Objects Hello Group: As you know, you can instantiate an Access form, just like any other object, by using its class name: Dim rFrm as Access.Form Set rFrm = New Form_YourForm ' form 'YourForm' This syntax allows you to create multiple open instances of a form, a necessity for my framework. However, I've run into a problem. What I need is a simple, one-line way to instantiate a form object using a string: sFormName = "YourForm" Set rFrm = MFOS("Form_" & sFormName) ' MFOS = "Magic Function or Syntax" Note: Because of the multiple instance requirement, DoCmd.OpenForm won't work. It can only make one instance of a form. I can't find a CreateObject syntax that works. In my current function, I use a big Case statement matching the form name to it's class. This has become a pain, because every time I add or remove forms, I have to edit the function. Have any of you found a way to do that? -Ken _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com