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
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