Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118

    Compile Errors Not Appearing

    Any time I click on a command button which has a compile error in the code, I am no longer getting the error pop-up. It just simply does not run the code.



    That would not be so bad in and of itself- but after it happens, I am unable to close the database.

    What's going on, and how do I fix it?

    Thanks for your help.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Always compile your code after making changes to it, and before you run it. In other words, in the VBA editor, do a Debug - Compile before saving. It's a good idea to do a compile from time to time anyway if you are making a lot of changes. Code errors can come back to bite you when you least expect it if you don't catch them first.

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    "Any time I click on a command button which has a compile error" - are we talking compile or run time error? A compile error runs when you try to compile or run code. A run time error only occurs when you try to run code. If your error only occurs at run time, it's not a compile error.
    "I am no longer getting the error pop-up" - your code probably turned off warnings. At least I think it extends to run time errors as well as action queries, but I don't think it applies to compile errors.
    It just simply does not run the code...but after it happens, I am unable to close the database. Likely your code is running - either a long query, or more likely, it is stuck in a loop. Suggest you copy the problem code and paste in a post (please use code tags) and we'll see if anything pops up.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Well, I don't have any code that's currently doing it because I fixed all my code. But to give you an example:

    Code:
    If 1 = 1 Then
        MsgBox "yep"
    In the past, when I've had code like this, I'd get an error message that says "Compile Error: Block If without End If." However, I don't get those pop-ups anymore- it just does nothing.

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Maybe decompiling and recompiling will help (change as required):

    "c:\Program Files\Microsoft office\office\msaccess.exe" /decompile "c:\MyPath\MyDatabase.mdb"

  6. #6
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Unfortunately, that did not work. However, it did solve another problem I was having in which Access was not recognizing a reference I had in vba, even though I checked off the correct object library. So, cheers on that.

  7. #7
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Did you try creating a new db and importing all the objects into it from the problem db? I've never heard of your issue before. I presume this problem only occurs in one db and not all.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Yep that works!

    FYI, this problem was occurring in multiple databases, but not all of them.

  9. #9
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Oh, wait. When I re-open the new database, the same problem appears again. But when I open the database holding the shift key, it's fixed. I guess there's some code I'm running at startup that is causing this issue. I'll look through it and try to identify the problem.

  10. #10
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Well, here's a strange conundrum. Even when I remove the AutoExec macro, I'm experiencing the same thing. If I open the database normally, I experience the problem- that is, no compile error messages. But if I hold the shift key when I open the database, then the compile error messages function as expected. I'm not sure why it's acting differently when I open with the shift key even when there is no AutoExec. Any ideas?

  11. #11
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    From Microsoft: "When you open a database while holding down the SHIFT key, many of the options that are set on the Current Database page of the Access Options dialog box are bypassed."

    I guess there is an option there - do let us know which one!

  12. #12
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    In the options for the database, is there a form that is selected to be opened on startup (Display Form..)? If there is, is there any code in its On load or On Open events?

  13. #13
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    John, there is a form that I open at startup with code in the On Load event. But even when I remove the macro that opens the form at startup, I still have the same problem.

    aytee, do you have any idea which one of those options might be related to the problem? I just don't see any connection between any of those options and whether or not compile errors appear.

  14. #14
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe you could post your dB???

    Do a "Compile and Repair", then Zip it. (Max Zip size is 2mb)

  15. #15
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Okay, I've attached it. Let me know what you think, please.

    (FYI, to get to design view, you may need to hold Shift when opening the db)

    Federal Award Database.zip

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Current entry not appearing
    By trident in forum Queries
    Replies: 1
    Last Post: 04-12-2016, 08:20 AM
  2. Query sum is not appearing
    By trident in forum Queries
    Replies: 3
    Last Post: 12-15-2014, 06:23 AM
  3. Replies: 4
    Last Post: 06-21-2014, 05:43 AM
  4. Replies: 1
    Last Post: 09-05-2012, 01:36 PM
  5. Replies: 10
    Last Post: 07-25-2011, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums