Microsoft Access 2465 Application Defined Error - Form control code reference/Compile issue. RRS feed

  • Question

  • G'day,


    One of the problems we have faced recently with an Access application that our company has written and supported for the last 11 years (Access 2 originally and now in Acccess 2003 ) is global variables and the VBA compiler.  We had some significant development, debugging issues with global variables going out of scope.  So in a crude solution to this problem we have move them all to form controls.





    However if we misspell the control name we can compile the application and when the code is eventualy used, we get the error: "2465 - Application-defined or object defined error".  This is killing us, because there are, lots of references to global variables (16 applications within the one Access database). 


    If we use the syntax



    We get the same error number but with a different message Eg. "2465 - Microsoft Access can't find the field "lblControlmisspelt" refered in your expression".


    This message is better, however the underlying problem is that the VBA code compiles where in most other VB syntax programming languages (VB6, you would get an compile error of some sort.

    1. Why is the VBA compiler for Access 2003 allowing missspelt controls with the following syntax? Eg Forms!frmName.ControlMisSpelt
    2. Why does debugging Access 2003 application cause global variables to loose/reset data?
    3. Why does Public properties in Forms also loose data while debugging in the same fashion as global variables?
    Tuesday, March 27, 2007 12:16 AM


  • One of our staff found the answer in a windows API that reads the names of captions for all the current running windows on a PC.  We can then use that to ensure two copies are not open.
    Thursday, July 5, 2007 6:30 AM