I have created a class which has a public property consisting of another class (which in turn contains another property referencing a third class), something like this (I have simplified it because I have used the VB Class Builder to create the classes):

Class 1 -- ZipCode:
Public Zip As String
Public Suffx As String

Class 2 -- Address:
Public Ad1 As String
. . .
Public AdZip As ZipCode
. . .

Class 3 -- Contact:
Public Name As String
. . .
Public HomeAd As Address
Public WorkAd As Address
. . .

I have declared a Public instance of Contact in a Module named MyContact.

Now, for example, when I want to assign a new value to a ZipCode, I have had to do the following:

Sub Text1_LostFocus()
Dim TempAd As Address
Set TempAd = MyContact.WorkAd
Dim TempZip As ZipCode
Set TempZip = TempAd.AdZip
TempZip.Zip = Text1.Text
Set TempAd.AdZip = TempZip
Set MyContact.WorkAd = TempAd
End Sub

When I try to do the following, I draw an error:

Sub Text1_LostFocus()
MyContact.WorkAd.AdZip.Zip = Text1.Text
End Sub

Is there a short hand that I am missing here? Why can't I get access to the properties directly?

Can some one help?



[Edited by New2VB on 06-16-2000 at 08:06 AM]