Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Posts
    15

    Question Unanswered: Compile Error?? Help

    Hi everyone,

    I am new to VB and the problem I have doesn't make any sense to me:

    I copied a VB code from one db across to another. Although it works fine in the old db, it brings up an error in the new db.
    The error message says "Compile error: Sub or Function not defined"

    Why is this happening? Am I forgetting something?

    Thx

    Alex

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188
    the codes call function(s) and/or sub procedure(s) that you didnt copy to the new db
    qha_vn

  3. #3
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    It is all in the references behind the tools menu in the vb window

    for instance if you imported a db from 97 to 2000 using some office90 object libraries (dao36.dll) you will get this error here is why:

    2000 automatically sets the reference of ADO in its tools/references
    if you import or copy code from 97 into a 2000 container even if you registered the dao3.5 or 3.6 ADO is still checked first on the list and therefore subsequent code/functions will not compile.

    Check the references and look for any listed items that are marked as "missing" - reselect them and deselect anythat you may not be using - ie the ADO 2.5

    This is a very common error when moving code to other apps.

    qha_vn is correct as well provided you only copied a snippet of code and not everything into your new objects or db - but if you moved "everything" then check tools/references from the VB window.
    Last edited by axsprog; 05-25-03 at 13:50.

  4. #4
    Join Date
    Nov 2002
    Posts
    15
    Hi axsprog,

    Thx for the explanation. Makes sense now.

    Can I just check with you, how does it look like when an item is marked as "missing"? I checked my references but none of them is marked.

    Thx

    Alex

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    NONE of your references are checked

    start your .mdb that isn't working and [Alt]-[F11] to open the Code window, in the Code window menu: Tools¦References

    ...none of the references are ticked???????????????

    izy

  6. #6
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    not checked and missing are two different issues - go the original app and see what is checked and in waht order - then go into the new app and reselect the same references in the same order.

Posting Permissions

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