none
Error "Requested type library or wizard is not a VBA project" with 2 levels Navigation form

    Question

  • Hello

    I am really desperate with an issue that has come up in my Access 2010 application.
    In this application I have a Navigation form which used to be a 1 level form but now I need it to become a 2 level Navigation form.

    While I am working with the ACCDB version everything works fine, but as soon as I convert it into a ACCDE, the following error message is displayed when I click on any Navigation button: "Requested type library or wizard is not a VBA project". 

    I have been doing some tests and I have seen where the problem comes from (but still don't know how to fix it). For some reason, if the navigation form is a 2 level one AND this navigation form has some vba code in it, then this error occurs (if only one of the previous conditions are present, it doesn't generate any errors).
    This is, if I change the "HasModule" property of the navigation form into "No", then the error doesn't occur. Also, if I remove the 2nd level navigation control and I leave just 1 level it works even if the HasModule property is "yes".
    I have tried to create a new navigation form, just in case the old one was corrupt but the error is still appearing.

    The thing is that I need the Navigation form to have 2 levels, I need it to have some vba code in it and I need to convert the application into a ACCDE...

    By the way, this application is a split DB. The Back end is a ACCDB, which stores all the data, and the front end is the one to be converted into ACCDE


    Any ideas?


    Thanks!!
    Wednesday, March 07, 2012 2:29 PM

Answers

  • Hi Wyoming1234,

    I was able to reproduce the problem on my end and have reported the issue to the proper people so that they are aware of it.  Unfortunately, I can’t guarantee if or when the issue will be fixed since that depends upon several factors.

    With that being said, I was able to work around the issue by using macros on the Navigation form in place of the VBA code.  Within the macro, I chose the RunCode action (you will need to click the show all actions button within the macro editor to see this action) and I then put the code I wanted to use inside of a public function.  So basically, I could still use the code on my navigation form, I just called it through an embedded macro commend instead of running the code directly.  Doing this will keep the Has Module property of the Navigation Form to “No” and you shouldn’t run into the issue.  If you try this workaround, I would suggest first creating your Public Functions within a VBA module.  Once this is done, you should be able to go back to your Navigation Form and change the Has Module property to No and then create the macro that uses the RunCode action to calls the public function.  The reason I have you write the code first is because once you change the Has Module property to No, it will delete your code.

    Hopefully that helps.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Wyoming1234 Friday, March 16, 2012 8:21 AM
    Thursday, March 15, 2012 6:33 PM

All replies

  • Just an Idea because I don't really know.
    Should you have two modules? 1 for the first level and 1 for the second?

    Chris Ward

    Wednesday, March 07, 2012 5:53 PM
  • I can't see how...

    Both navigation controls (1st level and 2nd level) are placed in the same navigation form, so they must be in the same module that's linked to this Navigation form.

    Wednesday, March 07, 2012 6:40 PM
  • Have you Decompiled lately then recompiled?

    Have you Compact and Repaired?


    Chris Ward

    Wednesday, March 07, 2012 7:10 PM
  • See this other thread

    http://social.msdn.microsoft.com/Forums/en-US/accessdev/thread/a225ccdd-129d-4b8c-872f-6d99fc58f049/

    or this one

    http://office.microsoft.com/en-in/access-help/HV080206805.aspx

    This one is long but has interesting stuff at the end. Referring to issues in older versions of Access but still may be the root cause for you.

    http://bytes.com/topic/access/answers/537003-different-vba-code-behaviour-mdb-mde


    Chris Ward



    • Edited by KCDW Wednesday, March 07, 2012 7:31 PM
    Wednesday, March 07, 2012 7:17 PM
  • Thanks a lot, Chris!

    Regarding your first questions:

    1. I have compiled the code and it was successful. I do not really know what do you mean by "decompile" (maybe it is a language problem, since I am not a native English speaker)
    2. Yes, I have compact and repaired

    As for the links that you have provided, it is funny but they are exactly the same links/threads I checked before but I wasn't able to find a helpful answer in them.

    I do not think the version issues have to do anything with this problem since this application has been fully developed under the same version (Access 2010 SP1)

    In these threads something is mentioned about the references and I have also checked this but, honestly, I do not know what to do about this. I have some references marked and some others are not marked but I do not know if there is something missing or not. Currently, the following references are marked:

    • Visual Basic for applications
    • Microsoft Access 14.0 Object Library
    • OLE Automation
    • Microsoft Access 14.0 Access database engine Object Library
    • Microsoft Windows common Controls 6.0 (SP6)

    Is there something missing? Should I mark anything else?

    Thanks!


    • Edited by Wyoming1234 Thursday, March 08, 2012 9:29 AM
    Thursday, March 08, 2012 9:05 AM
  • 1) Decompile -

    Right Click the desktop, Create new shortcut, Paste the following including the quotes

    "C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" /decompile

    save and close.

    left click drag and drop your icon for the database onto the icon for the decompile.

    If you need to bypass the startup macro then hold down the shift key (after password if you have one)

    after db opens the goto your visual basic and debug/compile/save

    then manually run the compact & repair.

    you can add to your quick access toolbar the visual basic and compact & repair icons for ease.

    another way is Start/Run/          msaccess /decompile

    2) Sorry the links were not helpful.

    3) In VBA screen when looking at the references, if you had some missing, they title would be preceeded by the word missing. I don't think that is your issue here judging from your last post.


    Chris Ward

    Thursday, March 08, 2012 2:57 PM
  • The common theme between these posts were the error message.

    4) This link was discussing the change of a link to a name because the form was added to the navigation form which means it is now a subform vs. a form and needed to be reflected in the link.

    http://social.msdn.microsoft.com/Forums/en-US/accessdev/thread/8fa90c66-412b-444c-b545-494b5d0dfdca

    3) This link discussed the missing references and gave a code you code run to check missing references via VBA. It also discussed late binding to avoid issues with references. Also discussed off handedly using the UNC path between the front end and the backend to ensure proper connection between the front end and backend.

    http://bytes.com/topic/access/answers/537003-different-vba-code-behaviour-mdb-mde

    2) This link discussed

    This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

    Not all elements available in Visual Basic are able to be both read from and written to. This error has the following causes and solutions:

    • You tried to write to an Addin or a type library from within a Visual Basic project. You can't directly write to a prepackaged Addin or a type library as part of a Visual Basic project.

    For additional information, select the item in question and press F1

    1) This link gave a work around you could try in a copy of the database - I was not able to find the cause of the problem. But I simply deleted that navigation form and recreated it (which was not too much work) and now everything works fine! So that first navigation form got corrupted somewhere.

    If you tried these ideas and they have not helped then we can try to find more answers.


    Chris Ward

    Thursday, March 08, 2012 3:10 PM
  • Thanks a lot for your time and help, Chris!

    First, I have followed your instructions to "decompile" step by step. The process went well but unfortunately the error persists

    Regarding the links you provided, I can't see how to apply them to this issue:

    Link 3: I think it might be a little too technical for my skills but anyway it is about including references in the vba code and I have not included any references at all in my code (I wouldn't even know how to do it). In fact, the problem comes up just by changing the "HasModule" property of the Navigation form into "Yes", even if the module is empty.

    Also, this link refers to .MDE, in my case it is an .ACCDE. I don't know if this is a relevant difference.

    Link 2: I can't really pick up the whole sense of this: You tried to write to an Addin or a type library from within a Visual Basic project. You can't directly write to a prepackaged Addin or a type library as part of a Visual Basic project.

    I am not familiar with references, Addins and/or libraries

    Anyway, I have been researching in other forums and it looks like this is a "known" bug of Access 2010. The only way to avoid it is by hiding it instead of fixing it :-/


    In the OnError event, using this code:

    If DataErr = -25357 Then
    Response = acDataErrContinue
    End If


    hides the error message and it lets you go on working.

    I don't like this solution since it doesn't actually fix the problem but it is the best I have been able to find...

    Thursday, March 08, 2012 3:58 PM
  • Hi Wyoming1234,
    Thank you for posting. 
    I will help you involve others to help you. There might be some delay about the response. Appreciate your patience.
    Best Regards,

    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, March 13, 2012 8:20 AM
  • In fact, the problem comes up just by changing the "HasModule" property of the Navigation form into "Yes", even if the module is empty.

    In your original post you said, "if the navigation form is a 2 level one AND this navigation form has some vba code in it, then this error occurs (if only one of the previous conditions are present, it doesn't generate any errors)."

    Please post the VBA code used.


    Chris Ward

    Tuesday, March 13, 2012 1:42 PM
  • I have been experiencing this exact same problem with a 2 level navigation form which contains vba code.  I actually created a blank, test database with a 2 level navigation form and added one line of test code.  I was able to reproduce the error when I clicked on the second tab at the top row of navigation buttons.

    Obviously I would like to fix the issue, however, I am in a bind and need to get my project rolled out.  I cannot figure out how to trap the event and ignore it.  Adding traps to the On_Click event on the navigation form tab does not catch the event.  Does anyone know where can I add an error trap to successfully suppress this warning message?

    Tuesday, March 13, 2012 3:47 PM
  • Anyway, I have been researching in other forums and it looks like this is a "known" bug of Access 2010. The only way to avoid it is by hiding it instead of fixing it :-/


    In the OnError event, using this code:

    If DataErr = -25357 Then
    Response = acDataErrContinue
    End If


    hides the error message and it lets you go on working.

    I don't like this solution since it doesn't actually fix the problem but it is the best I have been able to find...

    Earlier in this discussion post

    Chris Ward


    • Edited by KCDW Tuesday, March 13, 2012 4:37 PM Reduce text
    Tuesday, March 13, 2012 4:36 PM
  • Sorry about that.  My apologies.

    Tuesday, March 13, 2012 4:55 PM
  • Chris, even if I generate a brand new 2 level navigation form (without any vba code in it yet), as soon as I change the "hasmodule" property of this form to yes, this error comes up.

    So there is no vba code involved...

    Tuesday, March 13, 2012 5:18 PM
  • Is it possible to have a navigation form without any code?


    Chris Ward

    Tuesday, March 13, 2012 6:23 PM
  • Yes, until the very moment that you put some code in it  ;-)

    When you create a new navigation form, it doesn't have any code in it (as it happens with any other form). When you add some code, then the HasModule property changes automatically into yes.

    But this error is appearing if the HasModule property is changed to yes, even though there is no code in it.

    Tuesday, March 13, 2012 7:30 PM
  • Do you have any Macros in the Navigation Form?

    Chris Ward

    Tuesday, March 13, 2012 8:13 PM
  • No macros at all

    As I said, even creating a brand new Navigation form (no vba code, no macros) and including 2 navigation controls in a 2 level structure, the error appears as soon as there is  any code in this form.

    By the way, have you tried to replicate this issue to see if it happens to you? Maybe it can give you some clues...

    It only happens when the application is compiled to ACCDE, when it is ACCDB it works perfectly

    Tuesday, March 13, 2012 8:24 PM
  • No I can not as I am using Access 2007. I was just reading an article though that mentioned the same problem and as it turned out they had corruption in the database unrelated to the Navigation Form. When they imported the entire database into a new one and compiled and compact and repair, everything started working.

    Perhaps you should try this also. (After you make a backup)


    Chris Ward

    Tuesday, March 13, 2012 8:43 PM
  • Hi Wyoming1234,

    I was able to reproduce the problem on my end and have reported the issue to the proper people so that they are aware of it.  Unfortunately, I can’t guarantee if or when the issue will be fixed since that depends upon several factors.

    With that being said, I was able to work around the issue by using macros on the Navigation form in place of the VBA code.  Within the macro, I chose the RunCode action (you will need to click the show all actions button within the macro editor to see this action) and I then put the code I wanted to use inside of a public function.  So basically, I could still use the code on my navigation form, I just called it through an embedded macro commend instead of running the code directly.  Doing this will keep the Has Module property of the Navigation Form to “No” and you shouldn’t run into the issue.  If you try this workaround, I would suggest first creating your Public Functions within a VBA module.  Once this is done, you should be able to go back to your Navigation Form and change the Has Module property to No and then create the macro that uses the RunCode action to calls the public function.  The reason I have you write the code first is because once you change the Has Module property to No, it will delete your code.

    Hopefully that helps.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Wyoming1234 Friday, March 16, 2012 8:21 AM
    Thursday, March 15, 2012 6:33 PM
  • Thanks Nathan, I think this workaround can help.

    I hope in the next releases of Access 2010 this bug is fixed...

    Also thanks to Chris and others that have provided their support in this thread.

    Friday, March 16, 2012 8:30 AM
  • Hi all:

    If anyone is coming here because they, too, encountered this "error" in their ACCDE when moving between primary tabs on a two-tier navigation form, this answer resolved the problem for me: (http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26438281.html#a35743544).

    In short, create an OnError event for the main navigation form:

    Private Sub Form_Error(DataErr As Integer, Response As Integer)
       '//This addresses the annoying "Requested type library or wizard is not a VBA project" error.
       If DataErr = -25357 Then
          Response = acDataErrContinue
       End If
    End Sub
    Really, Microsoft, if you can't fix this problem, can't you at least publish the workaround?


    Duhdley d'Urite

    Sunday, August 12, 2012 9:46 PM
  • Earlier in this post...

    Anyway, I have been researching in other forums and it looks like this is a "known" bug of Access 2010. The only way to avoid it is by hiding it instead of fixing it :-/


    In the OnError event, using this code:

    If DataErr = -25357 Then
    Response = acDataErrContinue
    End If


    hides the error message and it lets you go on working.

    I don't like this solution since it doesn't actually fix the problem but it is the best I have been able to find...


    Monday, August 13, 2012 9:29 AM
  • Hi Wyoming 1234:

    I apparently have a diminished intellect, so I couldn't figure out how to trigger the "OnError" event referenced in this thread until I stumbled across the full solution.  I posted the entire subroutine for others similarly afflicted.


    Duhdley d'Urite

    Monday, August 13, 2012 3:56 PM