Class modules - Ambiguous Name Error

jon_sg

Registered User.
Local time
Today, 23:10
Joined
Oct 5, 2003
Messages
41
Class modules - watch out when naming properties

I have just encountered an interesting naming clash when adding some class modules to an existing database to enhance the forms and reports.

I am not sure why it happened not being an expert in access programing.

All the properties were defined using Let / Set / Get property procedures
All worked well untill I tried to open an existing unconnected form and it gave me an unspecified ambiguous name error on a subforms OnOpen Event which only checked the subforms parent property .

It took me ages to track it down to Property Get AmountPaid, I figured it must be something to do with the new class modules I had just written and I had the laborious task of renaming all the properties and methods and checking until the form opened normally.

The form in question did not create a new instance of LastBills class and I could not find any reference to AmountPaid in the forms code / call stack or in the object browser.

Previously I tried to use non cryptic property and method names for ease when instancing classes. I have now added the prefix prop for properties and meth for methods to ensure that this doesn't happen again.

Has anyone else encountered this - I am still baffled as to why it happened. All the form controls are named in the hungarian style ie txt, cbo, lbl etc.
Someone must know why

Regards

Jon Simpson
 
Ambiguous name error relates to having two or more procedures with the exact same name.

Are you sure you didn't copy and paste a second Property get AmountPaid or something?

If you want, I'll take a look at it for you - just upload a .zip.
 
And did you dimension the class properly, naming a NEW instance of it?
 
Thanks Mile

I checked the names of all property procedures with the object browser and could find no clash. If there was a clash I would expect to have seen it here.

There were also no repeats of names in the property procedures.

Also I had not actually got round to instancing any of the class modules as I am still in the process of writing them.

I am still perplexed as to why this occured, I have attached the offending class module let me know if there is a glaring mistake in it.
 

Attachments

I can't find anything wrong with the class module itself - so no faults there.

You did, however, mention that the problem occurred during an operation involving a subform. Any more information on that? Got the module, the form and subform, and undrlying recordsets available with test data?
 
I think I have sussed it out Mile, most of the data comes from three seperate db's tables linked over our network.

When I started the project (about 3months ago) I referenced the other dept db's to see if I could use any of the code. I must have forgotten to remove the references. The accounts dept have a public function AmountPaid.

It does beg the question as to why I couldn't see this in the object browser but deleting the reference and renaming the property as AmountPaid did not raise any errors.

Thanks for your Help

Jon
 

Users who are viewing this thread

Back
Top Bottom