Quirk in Access where 1 code error = "The expression On Load you entered as the ...
I ran across a particularly frustrating quirk in Access 2007 (perhaps other versions also).
After saving changes to code and reopening the form I was working on I kept getting the following general errors:
"The expression On Load you entered as the event property setting produced the following error: Expected Sub, Function or Property"
"The expression On Activate you entered as the event property setting produced the following error: Expected Sub, Function or Property"
"The expression On Got Focus you entered as the event property setting produced the following error: Expected Sub, Function or Property"
The same errors would occur everytime I reopened the form. I had code in the On Load and On Activate events but nothing in the On Got Focus event (the On Got Focus event in the Property Sheet was blank also)
I commented out all of the code in the On LOad and On Activate events and still got the same errors.
I had changed a good bit of code in a number of places on this form so I finally had to comment out all of the code in every event and uncomment them one event at a time until I found the offending code.
It turned out to be in the Click event of one of the command buttons. The line was: intMins CInt(cmbSaleTime_mins.Value)
Which should have been: intMins = CInt(cmbSaleTime_mins.Value)
Has this problem been corrected in any patches or anything? If not, does anyone know any way to stop it?
Thanks,
Marty
I ran across a particularly frustrating quirk in Access 2007 (perhaps other versions also).
After saving changes to code and reopening the form I was working on I kept getting the following general errors:
"The expression On Load you entered as the event property setting produced the following error: Expected Sub, Function or Property"
"The expression On Activate you entered as the event property setting produced the following error: Expected Sub, Function or Property"
"The expression On Got Focus you entered as the event property setting produced the following error: Expected Sub, Function or Property"
The same errors would occur everytime I reopened the form. I had code in the On Load and On Activate events but nothing in the On Got Focus event (the On Got Focus event in the Property Sheet was blank also)
I commented out all of the code in the On LOad and On Activate events and still got the same errors.
I had changed a good bit of code in a number of places on this form so I finally had to comment out all of the code in every event and uncomment them one event at a time until I found the offending code.
It turned out to be in the Click event of one of the command buttons. The line was: intMins CInt(cmbSaleTime_mins.Value)
Which should have been: intMins = CInt(cmbSaleTime_mins.Value)
Has this problem been corrected in any patches or anything? If not, does anyone know any way to stop it?
Thanks,
Marty