Compile error in Access 2013 query expression

I have an Access 2007 database that imports a .csv file into an existing table and then transforms the imported fields and stores them in the database tables. In Access 2007, this database executes correctly using an autoexec macro.

When I attempt to run the same database using Access 2013, the execution stops at an update query that uses the Mid() function and I see the error message "Compile error, in query expression 'Mid(<string>, <start>, <length>)".

When I open the database to repair the query, none of the expressions created by Expression Builder work. When I add a column that contains the function Now(), the column is formatted as Now() instead of Expr1: Now() and I get the error message "There was an error compiling this function". Since this is using expression builder, all the compiling is done internally by Access so there is no way to recode it and recompile it.

To fix this problem when using Access 2013, I need to reprogram the Access 2007 database in a fresh database using Access 2013.

Is there an easier way to solve this problem?

 

Question Info


Last updated September 28, 2018 Views 3,004 Applies to:

I'm not sure, but have you tried decompiling the application?

<path_to>msaccess.exe <path_to>your.accdb /decompile

-Tom.
Microsoft Access MVP
Phoenix, AZ

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Is the database in a Trusted Location? A2013 won't run VBA code otherwise.
John W. Vinson/MVP

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

yes, the application is in a trusted location

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

I don't think this will help. I believe the move from 32 bit to 64 bit Access is part of the problem.

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

I have discovered the reason for the error message. In the move from 32 to 64 bit Access, one of the modules in the database would no longer compile correctly. This affected how the built in functions were executed. It didn't matter that the module was not referenced in any of the database processes.

The error that caused this behavior was the change in the declare statement for Windows functions. The 32 bit statement was:

Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA" (lpName As Any, ByVal lpUserName$, lpnLength&)

The 64 bit statement must be:

Private Declare PtrSafe Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (lpName As Any, ByVal lpUserName As String, lpnLength As Long) As Long

My problem was that I couldn't find an explanation on Microsoft.com.

The answer was at http://pastebin.com/ibgW9c71

Thanks for you attention and for setting me on the right path.

12 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

how i can do that

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Create a shortcut like I indicated, then execute it.
-Tom.
Microsoft Access MVP
Phoenix, AZ

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.