Hi,
I have a class which is used to store customer information. For each customer there may be multiple contacts. How can I record this in a collection class. I've tried to do so as follows:
Code:' CCustomerInfo -> stores one customer record Public CompanyID As Long Public CompanyName As String Public CompanyAddress As String Public CompanyFaxNumber As String Public GeneralSupportExpiryDate As String Public HardwareSupportExpiryDate As String Public Contacts() as String <---- Error hereThe error message is as followsCode:' CCustomerInfos -> collection of CCustomerInfo objects ' this is how I add objects to the collection to the class ' not trying to add contacts() yet as I can't declare it correctly Public Function Add(CompanyID As Long, CompanyName As String, CompanyAddress As String, CompanyFaxNumber As String, GeneralSupportExpiryDate As String, HardwareSupportExpiryDate As String, Optional sKey As String) As CCustomerInfo Dim objNewMember As CCustomerInfo Set objNewMember = New CCustomerInfo With objNewMember .CompanyID = CompanyID .CompanyName = CompanyName .CompanyAddress = CompanyAddress .CompanyFaxNumber = CompanyFaxNumber .GeneralSupportExpiryDate = GeneralSupportExpiryDate .HardwareSupportExpiryDate = HardwareSupportExpiryDate End With If Len(sKey) = 0 Then mCol.Add objNewMember Else mCol.Add objNewMember, sKey End If Set Add = objNewMember Set objNewMember = Nothing End Function
Can anyone suggest a way to make this work? Thanks very much in advance.Code:"Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules"
Sorry for the lengthy post!
dhartigan




Reply With Quote