MarkH
lists at theopg.com
Wed Jan 21 10:28:49 CST 2004
Oooops... Should have read your post properly. Didn't realise you wanted to pass a form name as a string, sorry.... Good luck mark -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Erwin Craps - IT Helps Sent: 20 January 2004 20:30 To: Access Developers discussion and problem solving Subject: RE: [AccessD] Instantiate Forms as Objects Not at my knowledge neither. But there is a big advantage why that is so. When renaming forms or deleting or absence of (in case of importing routines that are dependant of a form) you would get an compile error straight away. When using syntax like "form_" & strFormName you would only get an error when you run the routine. I find this a very good thing.... Erwin -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, January 20, 2004 5:42 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Instantiate Forms as Objects 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 _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com