Results 1 to 19 of 19

Thread: [RESOLVED] Project Refence Issue With MID$ Function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Resolved [RESOLVED] Project Refence Issue With MID$ Function

    You've got to forgive me. I'm supporting an application written in VB6 and I'm not familiar with how VB6 works (I usually work with .NET).

    Anyway, I have some source code that compiles into a .DLL and have opened the project file and when I compile the thing, I get a "Compile error: Can't find project or library" error and it highlights the MID$ code. When I click on OK, it prompts me with the references window. So which reference am I missing? Do I need to update my VB6 or something?

    I'm truly a newbie and haven't touched VB6 in years so your help (and not laughter) is greatly appreciated....

    Thanks in advance.

    And is there a way to just compile it without running it?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Project Refence Issue With MID$ Function

    Welcome to the forums.

    You should a reference to VBA in your project.
    You should also have a reference to VBA objects and procedures and a reference to VBA runtime objects and procedures

  3. #3

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Project Refence Issue With MID$ Function

    Actually the problem is likely to be that "something" is missing from your references, not anything in particular.

    In the references list you probably have an item ticked which starts with "MISSING: ", and that is the problem. You need to replace this item with a working version - but how you do that depends on what it is (it may be something you have another version of, or it may not be installed on your system).

    And is there a way to just compile it without running it?
    Nope, and there would be no point - if it doesnt work when you are compiling, it wont work later.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    Thanks for the help so far.

    I don't see anything in my available references that is called "VBA..." but I do see something called "Visual Basic for Applications" and in fact, one of them is already checked, but when I scroll down the list, I see another 5 items on the list with the same name, "Visual Basic For Applications". Could it be that I have the wrong one checked? Should I just go ahead and check them all?

    As far as the "Missing" idea goes, you are right. There is one referenced called "MISSING: Microsoft CDO for NTS 1.2 Library". So if this reference is in fact missing, how do I go about installing it and refreshing the reference? Could ths CDONTS 1.2 library be causing my MID$ compilation error?

    Thanks for helping out this newbie.

  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Project Refence Issue With MID$ Function

    Quote Originally Posted by jayplus
    Thanks for the help so far.

    I don't see anything in my available references that is called "VBA..." but I do see something called "Visual Basic for Applications" and in fact, one of them is already checked, but when I scroll down the list, I see another 5 items on the list with the same name, "Visual Basic For Applications". Could it be that I have the wrong one checked? Should I just go ahead and check them all?

    As far as the "Missing" idea goes, you are right. There is one referenced called "MISSING: Microsoft CDO for NTS 1.2 Library". So if this reference is in fact missing, how do I go about installing it and refreshing the reference? Could ths CDONTS 1.2 library be causing my MID$ compilation error?

    Thanks for helping out this newbie.
    About Mid$. Try using VBA.MID$ in your code. Sometimes VB gets confused.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    Look at you Mr. Smarty Pants!

    The VBA.MID$ works. Now I can do a global search and replace, but instead (and I know I'm being picky), is there a reference that could be updated or something so I don't do it? Apparently it worked for the previous developer (she didn't need the VBA.MID$).

    Thanks...

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Project Refence Issue With MID$ Function

    Press F2 in the IDE to bring up the Object Browser. Then Type MID$ in the search box (the lower of the two dropdowns) and click the binoculars. Does it find more than one library that contains the MID$? BTW to my embarrassment kids in high school called me Smarty Marty.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    Thanks Smarty Marty!

    When I did the F2 thing, under Search Results there is only one entry:

    Library: VBA
    Class: Strings
    Member: MID$

    And just an FYI, I'm getting a similar problem with Chr. It seems like VBA.Chr works, but not Chr by itself...
    Last edited by jayplus; Aug 3rd, 2006 at 05:19 PM.

  10. #10

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    Like I mentioned above, after I did a global search & replace of MID$ to VBA.MID$, now it won't compile because of the Chr functions. It like VBA.Chr, but not Chr by itself. Do you think it's a reference thing? I'd hate to go through the whole thing and add VBA. to all the functions. Yowzah

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Project Refence Issue With MID$ Function

    Quote Originally Posted by jayplus
    As far as the "Missing" idea goes, you are right. There is one referenced called "MISSING: Microsoft CDO for NTS 1.2 Library". So if this reference is in fact missing, how do I go about installing it and refreshing the reference? Could ths CDONTS 1.2 library be causing my MID$ compilation error?
    It would be - there have been several similar cases before (with different Missing items, but the effect is the same).

    From a support article on microsoft.com (here), it seems that you need to have Exchange (Server or Administrator) or Outlook Web Access (for Exchange 5.5) installed - they will provide the required files for you.

  13. #13
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Project Refence Issue With MID$ Function

    Quote Originally Posted by jayplus
    Like I mentioned above, after I did a global search & replace of MID$ to VBA.MID$, now it won't compile because of the Chr functions. It like VBA.Chr, but not Chr by itself. Do you think it's a reference thing? I'd hate to go through the whole thing and add VBA. to all the functions. Yowzah
    What items are currently selected in your References?

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    I have the following referenced:

    Visual Basic For Applications
    Visual Basic runtime objects and procedures
    Visual Basic objects and procedures
    OLE Automation
    Microsoft ActiveX Data Objects 2.5 Library
    Microsoft Scripting Runtime
    Microsoft Script Control 1.0
    Crystal Reports 8.5 ActiveX Designer Run Time Library
    Microsoft VBScript Regular Expressions 5.5
    Microsoft XML, version 2.0
    MISSING: Microsoft CDO for NTS 1.2 Library
    Microsoft Word 11.0 Object Library

    The Visual Basic For Applications is located: C:\WINDOWS\System32\msvbvm60.dll

    When I scroll down the list under Available References, I find 5 "Visual Basic For Applications" options that are unchecked and I don't know if I have the wrong version checked. Why is there more than one? 3 of the unchecked options reference .OLB files, one of them references msvbcm50.dll. The other one has a location path that is longer than what the box is displaying. So I don't know what it is referencing...

    Thanks for your help. And your patience.

  15. #15
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Project Refence Issue With MID$ Function

    The first 4 that you show are the ones that are selected by default. The Visual Basic For Applications that is checked should be the one that refers to msvbvm60. I assume that msvbvm50 is associated with VB5 and this one with VB6. Can you eliminate any of the others? Are you using XML, scripting, Crystal Reports and Word, etc. all in the same project?

  16. #16
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Project Refence Issue With MID$ Function

    It's only the Missing one that matters, see the attached project (very small and simple) for an example.

    I added a fake reference which understandably gets shown as Missing, so several functions (including Mid and Date) have the same issue as above.


    The only way you can run (or compile) the program is to fix the missing reference, as described in my previous post.

    (in my example project you would just remove the reference, as it isnt used).
    Attached Files Attached Files

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    So I have the project installed on my local machine and I don't think installing Exchange or OWA for Exchange is an option. Is there any other options for getting CDONTS installed?

  18. #18
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Project Refence Issue With MID$ Function

    This may well do the job:
    http://www.microsoft.com/downloads/d...displaylang=en

    After copying the VBP file somewhere else (in case things go wrong), you can try to fix the references. You will probably need to select a new item in the references list (as it is a different version). Once you have done that you can remove the old reference.

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Aug 2006
    Posts
    23

    Re: Project Refence Issue With MID$ Function

    I think I got it to work. I copied the CDONTS.dll file from the test server to my local box and put it under the c:\windows\system32 folder and it compiled! Thank you to both of you for helping this newbie out.

Posting Permissions

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



Click Here to Expand Forum to Full Width