Access Error

%3CLINGO-SUB%20id%3D%22lingo-sub-1207101%22%20slang%3D%22en-US%22%3EAccess%20Error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1207101%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20open%20an%20application%20that%20works%20with%20Access%20and%20I%20keep%20receiving%20an%20error%20code%20that%20says%3A%20There%20was%20an%20error%20compiling%20this%20function.%20The%20visual%20basic%20module%20contains%20a%20syntax%20error.%20Check%20the%20code%2C%20and%20then%20recompile%20it.%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20click%20ok%2C%20another%20message%20box%20opens%20for%20Macro%20Single%20Step.%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20fix%20this%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1207101%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Visitor

I am trying to open an application that works with Access and I keep receiving an error code that says: There was an error compiling this function. The visual basic module contains a syntax error. Check the code, and then recompile it. 

When I click ok, another message box opens for Macro Single Step. 

How do I fix this issue?

1 Reply
Highlighted

@Serena1135 

There is an error in your VBA "somewhere". You must find it and fix it.

Start by opening the accdb with the SHIFT key held down (so-called "Shift bypass"). That bypasses any code running on the AutoExec macro when the accdb opens normally, or any code in any forms that open when the accdb opens normally.

Now, open the VBA IDE.

openIDE.png

Make sure that EVERY module has these directives.

OptionExplicit.jpg

Next, go to Compile on the Debug menu.

 

compile.png

 

This will force the VBA to compile and it will reveal the bad syntax in one or more procedures in one or more modules. Fix the syntax error(s) and recompile until the errors no longer cause compile to fail.

 

Save and restart. 

 

By the way, one should ALWAYS have these two directives in EVERY module. Option explicit will save you many hours of head-scratching as you try to find syntax errors.