[AccessD] Open Multiple Instances of a Form and passing a parameter

Kenneth Ismert kismert at gmail.com
Tue Aug 7 14:51:05 CDT 2012


Incidentally, this whole initialization brouhaha is all due to some
"Incidental Complexity" built into VB6/VBA: the lack of proper object
constructors.

In every modern language, you can specify a custom constructor for each
class. In VBA parlance, this would look like:

' SomeClass constructor
Private Sub Class_Initialize(sParm1 As String, lParm2 As Long, vParm3 As
Variant)
    ...
End Sub

Creating this class would look like:

    Set rClass = New SomeClass("parm1", 2, Null)

Since Access forms are classes, this would let you do things like:

   Set rForm = New Form_Orders(vCustID:="a123")

But instead, Microsoft punted, and we got Form.OpenArgs, a poor substitute.
Then, Access allowed multi-instance forms, but at the expense of not
specifying any OpenArgs at all. Poop!

So now, due to outdated language design, and lack of good substitutes, we
are wallowing in productivity-robbing alternatives, all due to incidental
complexity.

My approach is simply to simulate a proper class constructor, which passes
typed variables to a class instance.

-Ken


More information about the AccessD mailing list