[mso] Problem with Class object in VBA Access2k

  • From: "Alan Forster" <Alan.Forster@xxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Wed, 25 Sep 2002 15:29:03 +0100

Hello,

I have defined a class module, classCondition.
I have declared a public variable colConditionGrades in a module.
The sub below is used to populate the properties of the class object and th=
en add the class object to the collection.

Private Sub Build_colCondition()
    Set colConditionGrades =3D Nothing
    rstSurveyValues.MoveFirst
    Do While (Not rstSurveyValues.EOF) And _
             (Not IsNull(rstSurveyValues![Condition Grades]))
        Dim clsCondition As New classCondition
        clsCondition.ID =3D rstSurveyValues.Fields("IDValues").Value
        clsCondition.Grade =3D rstSurveyValues.Fields("Condition Grade Abbr=
ev").Value
        colConditionGrades.Add clsCondition
        Set clsCondition =3D Nothing
        rstSurveyValues.MoveNext
    Loop
End Sub

The run-time error message says that the object has not been set and breaks=
 on the line=20
        colConditionGrades.Add clsCondition

VBA has allowed me to make calls to clsConstruction to give values to the p=
roperties, but suddenly it says that the object has not been set.

If I right mouse click on the classConstruction in the Dim statement and as=
k to be shown the definition the error is given saying VBA can not find a d=
efinition.  However the object classConstruction appears in the object brow=
ser and the dim statement has been executed.

I have set Option Explicit at the start of all modules.

Any ideas what I am doing wrong? and how can I get this working.

Most frustrating is that I have copied the code from something that does wo=
rk!

Thanks in advance,

Alan.



The information in this e-mail is confidential and intended to be
solely for the use of the addressee(s) and may contain copyright
and/or legally privileged information.  If you are not the addressee
(or responsible for delivery of the message to the addressee) please
e-mail us at postmaster@xxxxxxxxxxx and delete the message from your
computer: copying, distribution, use or disclosure of its contents is
strictly prohibited.

As Internet communications are capable of data corruption no
responsibility is accepted for changes made to this message after it was
sent.  For this reason it may be inappropriate to rely on advice
contained in any e-mail without obtaining written confirmation of it.
In addition, no liability or responsibility is accepted for viruses and
it is your responsibility to scan attachments (if any).

Please note that for business purposes, outgoing and incoming
emails from and to the company may be monitored and recorded.

Mouchel Consulting Ltd. Registered Office: West Hall, Parvis Road,
West Byfleet, Surrey. UK. KT14 6EZ. Registered No. 1686040

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: