473,506 Members | 16,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class Module Issue - Property Set Statement

I have three custom classes in Access:

AdjustMgr
IDR
NPA

In the AdjustMgr, I have the following code (irrelevant code deleted):
..
..
Dim Doc as Object
..
..
Property Set Document(ByVal value as Object)
Set Doc = value
End Property

Doc will be an instance of the IDR or NPA class, depending on the circumstances.
Is this possible? When I set the Document property, I get the 438 error.

Thanks for the help,
Johnny
Nov 13 '05 #1
1 2456
On 10 Nov 2004 12:57:00 -0800, jm*******@gmail.com (Johnny M) wrote:
I have three custom classes in Access:

AdjustMgr
IDR
NPA

In the AdjustMgr, I have the following code (irrelevant code deleted):
.
.
Dim Doc as Object
.
.
Property Set Document(ByVal value as Object)
Set Doc = value
End Property

Doc will be an instance of the IDR or NPA class, depending on the circumstances.
Is this possible? When I set the Document property, I get the 438 error.

Thanks for the help,
Johnny


First, a comment. I recommend explicitly stating Public or Private on all
procedures and module variables, so it's clear if you intend them for internal
or external use.

Next, to answer your question. Yes, it's perfectly reasonable to use an
Object property to hold a class instance that could be of one type or another.
The only thing you lose is the ability for the compiler to tell you if you're
trying to pass an incorrect type, but that's not a problem when done in
moderation and for a good purpose. If you want to get fancier, you could
create another class to use as an interface, have both of your classes
implement that interface, and them use the interface type for the property in
the code above. Interfaces in VB are pretty klunky, though, so after using
them a lot for a while, I've backed off and tend not to use them so much.
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7659
by: Enigman O'Maly | last post by:
I'm still somewhat new to object style programming (as will become evident), using VBA in Excel 2000 to automate some previously manual functions. I've defined a class module so that I can...
3
2462
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of...
0
5603
FishVal
by: FishVal | last post by:
Hereby I'm proposing a way of convinient work with properties containing SQL Select statements, particulary RowSource property of ComboBox and ListBox. The usual way is the following. Private...
0
25482
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.