Category Archives: MS Access General Information

MS Access – Splitting and Deploying Your Database – Part 2

In my previous post entitled Splitting and Deploying Your Database, I elaborated on the critical importance of splitting your database before deploying it to your end-users.  That said, many people post questions regarding securing their applications from their end-users to minimize their ability to mess around with the database, mainly fool around directly with the tables.  In this post I will elaborate on a few possible step you can take as a developer to best secure your database from what I qualify of ‘dangerous’ users.

There are a few things that you can do to try and harden your database against your users.  In 2 instances, you have the ability to take some steps using programming to secure your app.  In the 3rd, you can deploy your application in a secured method.  Let’s examine each.

 

Hide Object Pane & Disable SHIFT Bypass

As a developer, you can do your best to make it as difficult as possible for any user to gain access to any of your database objects (tables, queries, forms, reports, …) to pose a threat in the first place.  To do this you need to:

  1. Create an autoexec macro the uses RunCode to execute a VBA procedure at startup
  2. In your startup procedure add in the following code
If SysCmd(acSysCmdRuntime) = False Then
    DoCmd.SelectObject acTable, , True
    DoCmd.RunCommand acCmdWindowHide
End If

This code will hide the Access object browser (the pane that lists all the database objects: tables, queries, forms, reports, …).  If they can’t see them, then they can’t mess around with them!

  1. Since any knowledgeable user knows that they can bypass any autoexec macros by holding the SHIFT key at startup, we need to disable the shift bypass capacity.  Now there is no point in rehashing this subject, so please refer to: http://access.mvps.org/access/general/gen0040.htm

 

Convert to MDE/ACCDE

One more step you can take is to convert your database (mdb/accdb) to an (mde/accde) format.  By doing so you lockout the user’s access to the all the VBA code.  Furthermore, this creates a compiled version of the database which mean it should be optimized for use.  Win, win.  Just remember you cannot do development on an (mde/accde), so keep your original file (prior to conversion) for further development.

 

Deploy Your Database Using Runtime

The last thing you can do to restrict your users and limit their ability to run amuck in your database is to deploy your application using MS Access’s runtime version.  Instead of giving your user the full blown MS Access application, only install the free runtime version.  Unless, your user needs to do development in the database, there is no need for them to have the full version of MS Access.  By doing this, your user will not be able to edit any of the database objects!  They will only have access to whatever you have developed and given them access to.  Also, note that when deploying using the runtime version ensure you put in place error handling throughout all of your VBA procedures, otherwise when an error is raised, the application will blatantly crash.  You can freely download and install the runtime version of MS Access directly from Microsoft’s website at: 

MS Access Runtime 2007 -> http://www.microsoft.com/download/en/details.aspx?id=4438
MS Access Runtime 2010 -> http://www.microsoft.com/download/en/details.aspx?id=10910

MS Office – Executable File Versions

It can sometimes be necessary to determine the version of the program you are working with in VBA and I have been unable to find a comprehensive listing.  Microsoft themselves have scattered this information over numerous pages?!  Here is what I have compiled myself thus far (Office 2000 through Office 2010 SP1).

 

Application Name Executable File 2000 2000 SP1 2000 SP2 2000 SP3 2002 2002 SP1 2002 SP2 2002 SP3 2003 2003 SP1 2003 SP2 2003 SP3 2007 2007 SP1 2007 SP2 2007 SP3 2010 2010 SP1
Microsoft Office mso.dll         10.0.2627.01 10.0.3520.0 10.0.4330.0 10.0.6626.0 11.0.5614.0 11.0.6361.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6213.1000 12.0.6425.1000   14.0.4760.1000 14.0.6023.1000
Microsoft Access  msaccess.exe 9.0.2720 9.0.3821 9.0.4402 9.0.6926  10.0.2627.1 10.0.3409.0 10.0.4302.0 10.0.6501.0 11.0.5614.0 11.0.6361.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6423.1000 12.0.6606.1000 14.0.4750.1000 14.0.6024.1000
Microsoft Binder       9.0.2702 9.0.2702                            
Microsoft Excel excel.exe 9.0.2720 9.0.3821 9.0.4402  9.0.6926 10.0.2614.0 10.0.3506.0 10.0.4302.0 10.0.6501.0 11.0.5612.0 11.0.6355.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6214.1000 12.0.6425.1000 12.0.6611.1000 14.0.4756.1000 14.0.6024.1000
Microsoft FrontPage frontpg.exe 4.0.2.2720 4.0.2.3821 4.0.2.4426 4.0.2.6625 10.0.2623.0 10.0.3402.0 10.0.4128.0 10.0.6308.0 11.0.5516.0 11.0.6356.0 11.0.7969.0 11.0.8173.0            
Microsoft Groove groove.exe                         12.0.4518.1014 12.0.6211.1000 12.0.6421.1000 12.0.6600.1000 14.0.4761.1000 14.1.6009.1000
Microsoft InfoPath infopath.exe                 11.0.5531.0 11.0.6357.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6214.1000 12.0.6413.1000 12.0.6606.1000 14.0.4763.1000 14.0.6009.1000
Microsoft OneNote onenote.exe                 11.0.5614.0 11.0.6360.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6415.1000 12.0.6606.1000 14.0.4763.1000 14.0.6022.1000
Microsoft Outlook outlook.exe/outlib.dll 9.0.0.2711 9.0.0.3821 9.0.0.4527 9.0.0.6627 10.0.2627.1 10.0.3416.0 10.0.4024.0 10.0.6626.0 11.0.5510.0 11.0.6353.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6212.1000 12.0.6423.1000 12.0.6607.1000 14.0.4760.1000 14.0.6025.1000
Microsoft PowerPoint powerpnt.exe 9.0.2716 9.0.3821 9.0.0.4527 9.0.6620 10.0.2623.0 10.0.3506.0 10.0.4205.0 10.0.6501.0 11.0.5529.0 11.0.6361.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6425.1000 12.0.6600.1000 14.0.4754.1000 14.0.6026.1000
Microsoft Project winproj.exe         10.0.2915.0 10.0.8326.0     11.0.5614.0 11.0.6707.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6423.1000   14.0.4751.1000 14.0.6023.1000
Microsoft Publisher mspub.exe         10.0.2621.0 10.0.3402.0 10.0.4016.0 10.0.6308.0 11.0.5525.0 11.0.6255.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6423.1000 12.0.6606.1000 14.0.4750.1000 14.0.6026.1000
Microsoft SharePoint Designer spdesign.exe                         12.0.4518.1014 12.0.6211.1000 12.0.6423.1000   14.0.4750.1000  
Microsoft Visio vision.exe/vislib.dll         10.0.525 10.1.2514 10.2.5110   11.0.3216.5614 11.0.4301.6360 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6423.1000   14.0.4756.1000 14.0.6022.1000
Microsoft Word winword.exe 9.0.2720 9.0.3821 9.0.4402  9.0.6926 10.0.2627.0 10.0.3416.0 10.0.4219.0 10.0.6612.0 11.0.5604.0 11.0.6359.0 11.0.7969.0 11.0.8173.0 12.0.4518.1014 12.0.6211.1000 12.0.6425.1000 12.0.6612.1000 14.0.4762.1000 14.0.6024.1000

You can also download a copy in csv format so you can import it into the program of your choice by clicking here.

Also, note that some of this information is impossible to find on any official website (but then again, why would I be writing such a post if it were!) so there could be mistakes.  This is based on what I could find online and what I managed to piece together by looking over various computers.  If you find mistakes, please use the contact form to send me an e-mail and I will make the necessary corrections promptly.

Here are a few of my references that I used to compile this list:
Office 2000
Office 2002 (Office XP)
Office 2003
Office 2007
General info on how to retrieve the Executable’s build number

MS Access – AutoNumber Field

We tend to see numerous questions relating to MS Access Autonumbers. Specifically, regarding autonumber not following sequence, skipping sequence.

What Are AutoNumbers and What Aren’t They!

Regardless of how one might interpret what is written in the help files, AutoNumbers should never, ever, ever, be relied upon as a sequential number. Nor should they ever be used/displayed to the end-user. The simple fact of the matter is that AutoNumbers are merely unique identifiers for each record. Even when set to be incremental, the AutoNumber can be indexed even though no record was actually inserted into the table. This is not a bug, this is simply the way Access was developed.

Sequential Numbering

So what does one do if they require a sequential number to attribute to each record.

The solution is actually very simple. Create a new numeric field in your table and then you can used an equation such as =Nz(Dmax(…), 0) + 1 to generate the next number in your sequence. At the end of the day, if you want a sequential number that will not jump sequence and can be faithfully relied upon, you have to create it yourself!

MS Access – Tables – Where to Create Relationships? In the Front-End or Back-End?

Now here is a question I had myself many years ago and could never find a proper answer to! And yet it is such a basic element and such an important one at that!!!

So when one creates a split database (which they all should be), where do you create the tables relationships exactly? Do you create the MS Access table relationship within the Front-End or the Back-End?

The short answer is, in the Back-End. Here are a few explanation from a couple fellow MVPs taken from a recent forum question.

Continue reading

MS Access – JET SHOWPLAN

I came across an article about optimizing queries using a hidden JET tool call SHOWPLAN which basically generates a showplan.out file (which is merely a text file) which elaborates the method(s) used by Access to execute the query. With this information, it is possible to perform query optimizations, determine which fields require indexing… to optimize your queries.  In some cases, this can have significant impact on database performance well worth the time invested!

I’m not going to rewrite the article, if the subject interests you, then simply look at the source:

A Few Extra Precisions

That said, I did want to try and add a little more information for anyone trying to get Showplan to work on Windows 7 (possibly Windows Vista – untested). To be able to use ShowPlan one must create a registry entry to enable it. In the original atricle, they indicate that the base registry key is found at:

\\HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\JET\4.0\Engines

this may be the case for Windows XP, but if you are using Windows 7 (and I suspect Vista as well) you will not find this key. Instead look for:

\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines

Once you locate the base registry key, create a new key entitled Debug, and create a String value entitled JETSHOWPLAN with a value of ON.  Finally, restart Access and the query plans automatically will get created in your Documents folder.

Office365 Click-To-Run Show Plan Registry Key

With the more recent Office365 Click-to-run versions of Access the registry key has changed.  For my installation, for Access 2016 x32 for instance, I ended up using:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Wow6432Node\Microsoft\Office\16.0\Access Connectivity Engine\Engines

I then created a new key entitled Debug, then created a String value entitled JETSHOWPLAN with a value of ON.  Then, I restarted Access and the query plans automatically got created in my Documents folder whenever I ran a query.

How did I know where to create this key?  I didn’t and documentation is impossible to find (what’s new).  I simply used the RegEdit’s Find tool to locate the term Access Connectivity Engine and was able to locate one with a key entitled Engines and then tried my luck by adding the Debug key… and it worked.  So even if the exact key does not exist for you, the above steps should enable you to find the proper key for your setup, but do be careful messing around with the registry!

So just be aware that the CTR versions use another registry key.

A Few Resources on the Subject

FMS Total Visual SourceBook Review

FMSTotal Visual SourceBook

What I wouldn’t have given to be aware of this add-in when I was starting out as a developer! Seriously, this add-in would have saved me hundreds, if not thousands, of hours searching online, posting to forums, to find out how to code what I needed to do. Beyond which, it provides the user with a standardized set of procedures, instead of trying to piece together countless routines found here and there as you search online.

Just yesterday, I needed a particular routine and instead of searching online, as I always have done until now, I opened the TVSB, performed a quick search, exported the appropriate code into my module and was back at work in a matter of 1-2 minutes, if that!

 

So what did I think of the TVSB?

Continue reading

MS Access – VBA – The Save Operation Failed

I was recently working on a database of mine which has been in production for over 4 years now and all of a sudden it started giving me the error: “The Save Operation Failed”. Nothing like a nice obscure error message from the VBA/VBE!!!

I tried the normal approaches: Compact and repair, Decompile/Recompile, … None worked for me.

I took a look at Microsoft’s Knowledge Base and found an article, ACC97: Error “The Save operation failed” When Saving a Module, for Access 97 (as a lot of the information can be used in future version, I read it over). Sadly, the article is pretty much useless.

In the end, the solution, for me, was to start a new database and import all of the database objects (File -> Get External Data -> Import) from the database giving me the error message. Setup the startup properties… and everything was in working order again!

I hope this helps someone else in the same predicament!

Microsoft Access Database Add-ins, Tools, Etc.

One thing any good worker will tell you is that you must have the right tools to do the job. Computer programming, MS Access database development, is no exception to this rule!

I thought I’d try and list a few add-ins and other useful tools that I have come across, or heard of, in the hopes it could prove useful to other developers.

This is an unbiased listing and I have no financial gain from any of the tools listed below. I am simply trying to regroup them to help you find them, and you can judge their usefulness on your own. In a future post, I will examine the 2 or 3 that I use myself and find very useful.
Continue reading

MS Access – Running Access on a MAC

Ever needed to run an MS Access database on a MAC? It can be done.

One solution, is to install Parallels Desktop on the computer. This enables one to run Windows software directly on a MAC. Once it is installed, you then would install the OS of your choice and the MS Access. So you need valid OS license and a valid MS Access license or use the free run-time version.

That said, at $80 for parallels and then another $200+ to get a copy of windows this starts to become an expensive endeavour if it is only to use MS Access! Never the less, it is a viable option for those looking for a solution to a problem.

MS Access – Running Access on Linux/Ubuntu

Have you ever had a client throw you the nice curveball of wanting to run an MS Access database on a Linux OS? Well, there is a workable solution.

You can install Wine on most Linux distributions. You can check out their website at http://www.winehq.org/download. You can also check out their brief page regarding MS Access at http://appdb.winehq.org/objectManager.php?sClass=application&iId=12

Overall, this seems to be a very good option for older versions, and slightly less reliable for the newer version (2007) with no data regarding 2010 compatibility. Depending on you needs, this is definitely worth checking out and the price is right, it’s free (you have to love open-source)!