Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    New York, New York, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compiler Error

    I am trying to convert a 97 Access database to 2007. When the compiler gets to the error handler

    Err_AddBook_Click:
    MsgBox Error$
    Resume Exit_AddBook_Click

    I get "Compiler Error Can't find object or library" with Error$ highlighted.
    Any help will be appreciated.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Compiler Error

    I am not familiar with Error$, but it seems to do the same job as err.description.

    Try replacing Error$ with Err.Description

    You can do a global replace in the VBA Editor.
    Regards
    John



  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Location
    New York, New York, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compiler Error

    John,
    Thanks very much. Your fix worked perfectly, only to lead to another error. In the statement

    If Left(CurrentText, 2) = "A " Then

    the compiler hung on Left, with the error message Compile error: Can't find project or library. Help tells me to display the References dialog box, by clicking References on the Tool menu, but References is grayed out on the Tools menu. I don't really understand the current Access model, but I'm guessing there is a library of functions I have to make available to my project, but I don't know how.

    I really appreciate your help - I wrote this code 10 years ago and a) I've forgotten a lot, and Access has changed so much, that I'm way over my head.

    Thanks again,
    Michael Trombetta

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Compiler Error

    References are grayed out when an error has occurred.

    Errors with the Left function are a common symptom of Reference problems.

    <UL><LI>Open the db with the shift key down - this bypasses normal startup
    <LI>Press Alt + F11 to activate the VBA editor
    <LI>Go to Tools...References. It should be available
    <LI>One or more of the ticked items will show "Missing"
    <LI>One by one, you need to untick them, and replace each of them with something equivalent from the list. Usually means just a different version number.
    <LI>Sometimes you might find that you can't find something equivalent, because your db uses some other application that is not installed on this computer. If that is the case you will to make some changes or find something equivalent.[/list]
    Regards
    John



  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Location
    New York, New York, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compiler Error

    John,

    Thank you again.

    The reference that is missing is to utility.mda (all lower case). It is found in C:Program FilesMicrosoft OfficeOffice. When I browsed to the location and tried to add it, I got the error message Can't add a reference to the specified file. When I run the database under Access 97, I see a reference to the same file, utility.mda, and 97 seems to not have any trouble with it. Is there a new version with a different name?

    Michael Trombetta

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Compiler Error

    I don't know what it is, but from reading this it seems that removing the reference may be enough to fix the problem.

    This Microsoft article seems to confirm that you don't need it.
    Regards
    John



  7. #7
    Star Lounger
    Join Date
    Apr 2002
    Location
    New York, New York, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compiler Error

    Thanks once more! I just removed the reference to utility.mda and the database compiled perfectly.

    Without your help I would have been going around in circles for a month.

    Thanks,
    Michael Trombetta

  8. #8
    Star Lounger
    Join Date
    Apr 2002
    Location
    New York, New York, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compiler Error

    John,

    Everything is working just fine, but it is very hard to see what was going on.

    I got an error message when the compiler encountered Chr. Presumable the code for Chr is in utilities.mdb, but Access 2007 can't use that file, so it hangs. Then I removed the reference to utilities.mdb. So the compiler says, the definition of Chr is in utilities.mdb, but that is not part of this project, so I'll just look around, and lo and behold, it finds a definition somewhere else, uses it, and goes along merrily! When it couldn't use utilities.mdb, why didn't it look around for an alternative source for Chr code on its own? Why did it have to wait for me to remove the reference to utilities.mdb?

    Maybe that's the way it happened, but it sure is strange.

    Thanks for you help,
    Michael Trombetta

  9. #9
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Compiler Error

    Michael

    I don't pretend to understand how this works.

    Reference problems are a constant source of problems for me, and when they are not right things don't work!
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •