[AccessD] Can't call methods I've added to a form?

Christopher Jeris cjeris at fas.harvard.edu
Mon Jul 23 12:50:47 CDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to build a set of forms according to MVC principles, and I
think there's something fundamental I don't understand about Access form
objects.  Everything here is unbound forms, in Access 2002 sp3.

I need to have "forms" that serve the same application role but present
different user interfaces according to context, so I build a Controller
object that creates different Form (view) objects depending on the
context.  But the Controller needs to tell the view to update itself in
certain ways, so I have a method in the form's class like

Public Sub InitializeFromBuffer(buffer As DataModelObject)

and then the controller's process for opening up the form goes something
like

Set Me.activeForm = OpenFormByContext(intendedFormClass As String, _
  context As ContextInfo)
If Not Me.activeForm Is Nothing Then ' it worked
  Set Me.activeForm.Controller = Me
  Me.activeForm.InitializeFromBuffer theBuffer ' FAILURE
End If

Now calling InitializeFromBuffer ... or any other public method I try to
add to a Form object ... from outside that Form's own class ... results
in an "Application-defined or object-defined error".

Is it really not possible to add methods to a Form that get called from
outside the Form -- or am I missing something obvious ?

I suppose, since adding _properties_ seems to work okay, one kludgy
workaround would be to give the Form a property that is its "view proxy
object", which is a user-defined class where all the methods I want to
add are located, and call methods through the view proxy object ... but
I'd rather say what I mean.

thanks, Chris Jeris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGpOp35ICCNV0oGWARAiGDAJ9DwZIZ+eo3V/MsLOxBaT2/Y5wzwACgmb4+
j5Xtsy7ZmlM6bOkXXzOS3QY=
=rjCB
-----END PGP SIGNATURE-----



More information about the AccessD mailing list