bind form to class?

C

Craig Buchanan

Is it possible to bind a form to a class' method? If so, what are some of
the issues related to this?

Thanks,

Craig Buchanan
 
A

Albert D. Kallal

No.

But you can certainly add new methods to a form, since a form is in fact a
class object.

This also means you can have multiple instances of a form opened at the same
time.

However, I certainly often add a class object to a form. You can expose that
object by declaring the object as public in the forms module. Like:


Option Compare Database
Option Explicit

Public MyTour As New CRide ' Tour class object


Now, any code can use, or set, or get properties/methods of that object
like:


forms!Customer.MyTour.HotelCapacity

So, often, I do add a class object to the forms module defs, and if you make
it public, then you can use all of the features of object. And, remember,
you can still have multiple instances of that form open, and each form will
thus have its own copy of that object.

Here is an article on using class objects in access:

http://www.attcanada.net/~kallal.msn/Articles/WhyClass.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top