FUNCTIONS NO LONGER WORKING IN ACCESS

This issue has been plaguing me for a few years now.  And some of you will suggest things that I have tried OVER and OVER again.  I've created new modules/databases in Access 2016, imported everything from the old modules into the new modules.  Decompiled, recompiled..., and still, certain functions will not work on different PC's, and even servers.  For example, the Nz function has all of a sudden stopped working in the compiled version for just one of the modules?!  My program consists of 45 separate modules.  And it will work in some, and not in others?!  I have checked and recheck References....  I've tried Access 2010, 2013, and 2016!  If the module was created using 2010, and I compile it on the machine having issues, then it will work opening it up in Access 2016.  If I literally compile the 2016 version on the machine having issues, it will NOT work in the compiled version!  It will work correctly in the uncompiled version, but not in the compiled version.  This is BEYOND frustrating as it is 100% ABSOLUTELY a problem caused by Microsoft!  I earn my living using Access....  But here in the past 10 years or so, issues that come up with this program are NOT being resolved by Microsoft.  They think that we don't know what we're talking about, so they don't dig deep enough.  I am literally jumping through hoops to make things work.  Is there ANYONE out there who is listening and can resolve these issues?!

Now, this is going to be a dumb question, but I just want to clear the air on it so that we can move on.  You have created a Trusted Location for your database front-end?

My first guess would be you are affected by https://www.devhut.net/2018/10/31/ms-access-bug-vba-code-doesnt-run-as-accde/.  This seems to be more and more an issue where it never used to be.

--
Daniel Pineault
Microsoft MVP 2010-2021

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Let's set the blame game aside for a while and focus on what you CAN do.

That includes modifying your startup code along these lines.

Let's assume you already have an AutoExec macro that starts the app. If not, you need one. No startup form.

That macro is a one-liner and will use RunCode to call one new function in a new standard module. Let's call it CheckReferences in modReferences.

Everything written in that module, including every procedure it calls, must be written with 2-part function calls, so 

Dim ref                 As Access.Reference

rather than

Dim ref                 As Reference

Access.DLookup

rather than

DLookup

etc.

In that function you loop over the Access.Application.References collection, checking each one for IsBroken.

If you find one, use its Guid to DLookup its name in a new table in the FE (NOT in the BE - at this point we have not even connected to the BE) and display to the user and quit.

The new table is populated with at least Guid, RefName, and RefPath, using another new function in the same module. Before you deploy any new version you re-run this function.

This will allow you to check references at startup time, and only if it passes this test you will call your normal startup function. In my case modInitApplication.InitApplication.

Of course you also have to compile your ACCDE in the lowest version of Access that your users may have. Having a clear picture of what everyone has installed is important data that you really want to have. If you have references to other Office applications or 3rd party apps you want to know those versions as well.

-Tom.
Microsoft Access MVP
Phoenix, AZ

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Tom –

Questions re the new table:

Why use a new table when the guid, path, and name of a reference is contained in the References collection? (I hypothesize, since one of my references has no guid.)

And isn’t that going to be erroneous information, since the link is broken?

Author of The Ten Commandments Of VBA For Microsoft Access Newbies

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Good question. If IsBroken, then RefName is Null. If memory serves RefPath is still available, but it is no good because it's perfectly valid to have different paths to references on different machines.
-Tom.
Microsoft Access MVP
Phoenix, AZ

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Guys, I want to thank you for your responses.  I found the problem, and resolved, and I want to share what I found with everyone.  Within my program, I have references to Outlook and Excel.  I import Excel files, and I email from within my program directly..., using Outlook.  I have converted my program to the next iteration of Access, as the need arose, and I have been able to install Access 2007 versions of Outlook and Excel, and the program worked fine...., until Access 2016.  I found that what was necessary was to install the FULL versions of Outlook and Excel with the version matching the Access version.  Once that was done, I no longer had any function errors.  And I realize that some of you more experienced programmers out there will chastise me for using 2007...., but you don't know if something doesn't work..., until it doesn't work.  So mea culpa for placing the blame on Microsoft, but given some of the patches that have caused issues over the years.....  Need I say more.  But I hope this helps!  While multiple versions may have worked in the past, it is a best practice to keep one single Office version on servers.  (I use Terminal Services faithfully.)

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Thanks for sharing.

It is possible to use different versions of Office, but I have found as well that it may not work on every workstation. Never had enough time available to chase it down. Compiling on that machine would work so we moved on.

Glad you got it to work and thanks again for sharing your solution.

-Tom.
Microsoft Access MVP
Phoenix, AZ

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

Out of curiosity, were you coding using Early Binding (using references libraries) or Late Binding (no reference librairies)?  I ask because I'd be surprised if you'd experience this with Later Binding techniques.
--
Daniel Pineault
Microsoft MVP 2010-2021

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

I am only now getting familiar with the term of "binding".  But I use the reference libraries before publishing the application.  So I would say that I use Early Binding.   What is interesting, is that an Outlook reference, would affect functions that aren't native to Outlook?!  Meaning that chasing down why an Nz function, or the CCur function won't work...., was daunting!  And to then find that the resolution was installing the correct version of Office on the server, was pure luck!!?  I have multiple versions of Office on my own desktop, so it never occurred to me that there would be conflicts on the servers.  But like I said, I have LEARNED from this, and will make sure that things are kept in sync from here on out.  It is a good starting point if trouble shooting is called for.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

You get into those types of errors when you try and use a database on an older version that it was previously run.

You see, say you developed a db in 2007, then it gets run by a user in 2013 and later, a 2010 user goes to use the database, they will get these types of errors.  When opened in 2013 Access automatically upgraded the reference to 2013, so when you go to 2010, it no longer works.  This is why it is crucial to do all development using the oldest version that will be used to run the database and deploy a personal copy of the front-end to each user (no sharing of a common front-end can be permitted).

--
Daniel Pineault
Microsoft MVP 2010-2021

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

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

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 23, 2024 Views 2,361 Applies to: