[AccessD] Example of Class Module usage needed

Jim Dettman jimdettman at verizon.net
Mon Sep 26 06:33:31 CDT 2016


 Among developers who only do VBA, yes.   But anyone who does something like
VFP or .Net certainly understand classes.

 I think if VBA was more object orientated, we'd be talking about an
entirely different situation when looking at Access code.

 While there are places where you can use classes and use them well, without
inheritance at least, your stuck doing things along the lines of traditional
linear programming.

 One example; you create a text box class that handles dates.   First, you
need to create it from scratch.  You simply can't subclass off a text
control.  Then, you need to hook it up yourself on every form instead of
simply dropping it on a form at design time.

 Another example; If I want to change the text control behavior (say the
font) of all text controls, I need to modify every class I've created rather
than changing the text class itself.  But if you had this for a hierarchy:

Base control
  Text control
    Framework text control
      App specific text control
        My date text control


 Then I would just have to change it once on any one of the levels besides
the last and be done with it.

 And that's where VBA looses out when it comes to using classes.

Jim. 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
John Colby
Sent: Sunday, September 25, 2016 04:15 PM
To: Access Developers discussion and problem solving; Access Developers
discussion and problem solving
Subject: Re: [AccessD] Example of Class Module usage needed

You are of course correct, but then I am one of the few that understands 
them.

;-)


On 9/25/2016 3:21 PM, Jim Dettman wrote:
> You one of the very few that does.
>
> Jim
>
> Sent from my iPhone
>
>> On Sep 24, 2016, at 9:02 PM, John Colby <jwcolby at gmail.com> wrote:
>>
>> I would not code in Access without them.  :)
>>
>>
>>> On 9/23/2016 9:38 AM, Jim Dettman wrote:
>>> <<Classes are swiss army knives in Access. >>
>>>
>>>   I find there are very few that bother to use them.
>>>
>>>   More often then not, it's just straight code.   The real power in
using
>>> classes is lost in VBA because it does not have full inheritance.  VBA
is
>>> object based, bit not object orientated like you have in a fully
compliant
>>> OOP language.
>>>
>>> Jim.
>>>
>>> -----Original Message-----
>>> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>>> Charlotte Foust
>>> Sent: Thursday, September 22, 2016 07:32 PM
>>> To: Access Developers discussion and problem solving
>>> Subject: Re: [AccessD] Example of Class Module usage needed
>>>
>>> Classes are swiss army knives in Access.  You can use them for all sorts
of
>>> things, not just to represent something like a table.  For example a
>>> Customer class might return the customer name information, all the
>>> associated addresses from the Address table, Order history for that
>>> customer, etc.  In a simple Access databases, there isn't much point,
but
>>> where relational information is structured properly, they can be a quick
>>> and direct way of returning requested information from multiple tables
or
>>> accepting input and writing it to the appropriate table.
>>>
>>> One of my favorite uses is to declare a clsForm and pass it the form
object
>>> it should work on.  That will allow binding the open form to an instance
of
>>> clsForm and putting uniform behavior or procedures you want available in
>>> all forms in the class.
>>>
>>> Charlotte Foust
>>> (916) 206-4336
>>>
>>>> On Thu, Sep 22, 2016 at 1:22 PM, <ewaldt at gdls.com> wrote:
>>>>
>>>> I've been automating Access and Excel for years, but never got involved
in
>>>> creating class modules (except the ones behind forms and reports, of
>>>> course). I'm now in the process of converting one of my Excel projects
>>>> over to using a class module, and I can see where it's going to be
useful
>>>> (very quick, too). In this case, the class basically a more capable,
more
>>>> flexible array, with some methods built in. I'm having trouble
envisioning
>>>> why they would be needed in Access, though. Obviously they ARE needed,
but
>>>> I don't see it. Other than the built in methods, it seems like tables
and
>>>> arrays would handle everything. Would anyone like to offer an example
of
>>>> how you would use them?
>>>>
>>>> Thanks in advance for any help (and patience).
>>>>
>>>> Tom Ewald
>>>> Mass Properties
>>>> General Dynamics Land Systems
>>>>
>>>> ----------------------------------------------------------------------
>>>> This is an e-mail from General Dynamics Land Systems. It is for the
>>>> intended recipient only and may contain confidential and privileged
>>>> information.  No one else may read, print, store, copy, forward or act
in
>>>> reliance on it or its attachments.  If you are not the intended
recipient,
>>>> please return this message to the sender and delete the message and any
>>>> attachments from your computer. Your cooperation is appreciated.
>>>> &&
>>>> --
>>>> AccessD mailing list
>>>> AccessD at databaseadvisors.com
>>>> http://databaseadvisors.com/mailman/listinfo/accessd
>>>> Website: http://www.databaseadvisors.com
>> -- 
>> John W. Colby
>>
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>

-- 
John W. Colby

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list