• MISSING Object Libraries (2002/2003)

    Author
    Topic
    #409601

    While developing a database, I’m moving it between two machines — one has Access 2002 and the other has Access 2003. After each move, it seems like I have to go to the VBA editor, look at Tools…References and resolve the “MISSING” items (usually involving switching from version 10 of an Office object library to version 11, or vise versa). Is there any way to avoid this (besides upgrading to Access 2003 on the one machine)?

    Thanks.

    Viewing 1 reply thread
    Author
    Replies
    • #874202

      If you’re writing code using one of the Word objects, it might be usefull to do a search for Late Binding.

      By using late binding, your application shouldn’t be affected whichever version you are using.

      • #874338

        I’m using Word, Outlook, and Excel objects. So, declaring them all as “Object” rather than the specific object type will solve the problem? I’ve heard that late binding slows things down — in reality, is this much of an issue?

        Thanks, Dave.

        • #874448

          It depends on what you’re doing. It will allow the code to compile. However, you still need references to those object libraries, even if you use late binding. Late binding just means you declare something as an Object and then set the object variable by creating an instance of, say, a Word Application. You still need the Word object library reference, but if it isn’t there, the code will still compile. If you explain exactly what you’re trying to do, perhaps someone can give you specific help.

          • #874652

            Okay, here’s a simple example of what I’m doing: I have some VBA code that creates an Outlook message. The routine declares Dim objMessage as MailItem. I’m using Access 2003. I give the .mdb file to someone else to test. He’s using Access 2002. He can’t run it because “Microsoft Outlook 11.0 Object Library” is MISSING in the References list. If we scroll down the list to “Microsoft Outlook 10.0 Object Library” and reference that, then the code works.

            Dave seemed to indicate that if I declare Dim objMessage as Object instead (i.e., late binding), we won’t have this “compatibility” problem (i.e., we won’t have to “realign” the references). Charlotte, you seem to indicate otherwise.

            • #874790

              You won’t have to change the *code*, but you will still have to clean up the reference. Sorry, but late binding isn’t magic, it just allows you to set an object to an instance of the Outlook version running on that machine. A broken reference will mess up more than just the code that specifically uses it. In fact, you can have a broken reference that you don’t even use and it will cause you grief.

            • #874865

              Thanks for the help, Charlotte. I’m curious, how do the “pros” ensure that a “professional” application will run across different Office versions if the application includes this sort of automation code? Is it still a problem if an MDE file created? Or do they just avoid references to other Office object libraries?

            • #874987

              It’s a worse problem in an MDE because references can’t be changed there and they don’t really resolve themselves even when they compile. We’ve run into problems occasionally, so we tend to use the generic code to output to another app, etc., instead of automation. You can fix references in code, but it requires fully referenced code that runs before any other code and lives in a separate module, so that it loads and runs without tripping over the broken reference.

            • #874988

              It’s a worse problem in an MDE because references can’t be changed there and they don’t really resolve themselves even when they compile. We’ve run into problems occasionally, so we tend to use the generic code to output to another app, etc., instead of automation. You can fix references in code, but it requires fully referenced code that runs before any other code and lives in a separate module, so that it loads and runs without tripping over the broken reference.

            • #874866

              Thanks for the help, Charlotte. I’m curious, how do the “pros” ensure that a “professional” application will run across different Office versions if the application includes this sort of automation code? Is it still a problem if an MDE file created? Or do they just avoid references to other Office object libraries?

            • #874791

              You won’t have to change the *code*, but you will still have to clean up the reference. Sorry, but late binding isn’t magic, it just allows you to set an object to an instance of the Outlook version running on that machine. A broken reference will mess up more than just the code that specifically uses it. In fact, you can have a broken reference that you don’t even use and it will cause you grief.

          • #874653

            Okay, here’s a simple example of what I’m doing: I have some VBA code that creates an Outlook message. The routine declares Dim objMessage as MailItem. I’m using Access 2003. I give the .mdb file to someone else to test. He’s using Access 2002. He can’t run it because “Microsoft Outlook 11.0 Object Library” is MISSING in the References list. If we scroll down the list to “Microsoft Outlook 10.0 Object Library” and reference that, then the code works.

            Dave seemed to indicate that if I declare Dim objMessage as Object instead (i.e., late binding), we won’t have this “compatibility” problem (i.e., we won’t have to “realign” the references). Charlotte, you seem to indicate otherwise.

        • #874449

          It depends on what you’re doing. It will allow the code to compile. However, you still need references to those object libraries, even if you use late binding. Late binding just means you declare something as an Object and then set the object variable by creating an instance of, say, a Word Application. You still need the Word object library reference, but if it isn’t there, the code will still compile. If you explain exactly what you’re trying to do, perhaps someone can give you specific help.

      • #874339

        I’m using Word, Outlook, and Excel objects. So, declaring them all as “Object” rather than the specific object type will solve the problem? I’ve heard that late binding slows things down — in reality, is this much of an issue?

        Thanks, Dave.

    • #874203

      If you’re writing code using one of the Word objects, it might be usefull to do a search for Late Binding.

      By using late binding, your application shouldn’t be affected whichever version you are using.

    Viewing 1 reply thread
    Reply To: MISSING Object Libraries (2002/2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: