Category Archives: MS Access Reports

MS Access Reports

MS Access – Print Individual PDFs of a Report

Here’s another common request.

Say you have a contacts report and like to print each client’s individual report separately as a PDF. How can this be done exactly? A concrete example might be a billing database in which you have an Invoice report (which would be comprised of all the records) and you’d like to print each invoice separately. Or just the outstanding invoices… you get the idea.

Generating PDFs on the Hard Drive

Approach 1 – Individual Reports

The General Concept

The general concept is pretty straightforward:

  1. Defined a recordsource that you’re going to use to filter the report to get those records you seek
  2. Open the report filtered based on the above
  3. Print the report as a PDF
  4. Close the report
  5. Repeat for each record in 1

Continue reading

Access – Let’s Talk Colors

Just a quick post to discuss colors in Access.

Colors can be an asset to designers, if used correctly, to greatly enhance your application(s), no doubt!

But how can we define colors is the question I thought I’d quickly touch upon today.

All too often I see in code people defining thing along the lines of

'Set the font color of a control
Me.ControlName.ForeColor = vbRed

where developer use one of the predefined ColorConstants, which include:

  • vbBlack
  • vbBlue
  • vbCyan
  • vbGreen
  • vbMagenta
  • vbRed
  • vbWhite
  • vbYellow

There are 2 major issues with the above (excluding the use of vbBlack and vbWhite): the choices are very limited and the colors are very aggressive (not colors I’d recommend to use as they are hard to look at, so not a good user experience).

Continue reading

MS Access Security Demo Database

Security and Access, where to start?  What to do?

Security can be simple and complicated, it all depends on your needs and abilities.  It can be superficial, as it can be very granular.  As such, I thought I’d present a couple options to help people get going in the right direction.

What does this demo illustrate?

In the demo, I demonstrate 3 different techniques:

The Static Password Approach

  • How to password protect a single command button using a hard-code VBA password

The Dynamic Automatic Authentication

This use a set of security tables that you setup once and then the database can automatically authenticate and apply security as required.  Although this example demonstrates restricting access to a command button, it can be used to control access to forms, reports, …

Continue reading

MS Access Reserved Word Checker

If you aren’t already aware of it, there are a set of words which should never be used to name

  • Database objects (Tables, Queries, Forms, …)
  • Table/Query Fields
  • Form/Report Controls
  • VBA procedure names, variable, …

these are referred to as Reserved Words and thus Reserved Words need to be avoided at all cost as they can generate strange behaviors or outright failure of your database.

There are numerous examples of oddities caused by Reserved Words, but below is one of them as an example:

 

The issue with Reserved Words is that there is simply no way to remember them all.  Furthermore, when taking over another developer’s work, it is next to impossible to review every object, control, … for such terms.

Continue reading

MS Access – Find Macros Using a Search Term

To continue my original post, entitled MS Access – Find Embedded Macros, regarding identifying where Embedded Macro were being used within an Access database, I also develop the following procedure that enable one to search through all Embedded Macros and Standard Macros for a search term. The search term can be anything, object names, commands, segments of words, …

I originally was using this to identify where Forms were being called since I needed to rename them.

Continue reading

MS Access – Find Embedded Macros

Most people already know that I do not favor Embedded Macros in any capacity. Unlike VBA, Macros are more complicated to program, are not searchable making it hard to perform database updates.

Long story short, I was working on a project a short while ago where I need to do a major cleanup of object names, control names, … and was needing to identify where object were being used so I could update them. Then I decided, even better, let’s find all the Embedded Macros so I can simply convert them over to plain VBA and then this problem would not occur again in the future.

As such, I put together the following procedure which goes through all the database Forms and Reports and their respective controls to identify those that use Embedded Macros. Hopefully it can help someone else.

Continue reading

Great Access Tools – Access Crash Reporter

I’m starting a series of posts to promote some great tools to be aware of as an Access developer

Today, I’d like to introduce you to TheSmileyCoder’s Access Crash Reporter.

Any developer can attest that errors will occur and quite often users do not jot down the details of exactly what happened exactly thus making it very difficult to troubleshoot at times.  The Access Crash Reporter is a tool through which you can collect error data so you don’t have to solely rely on the users account of the problem.

This free tool gathers a tremendous amount of information:

  • Error Source
    • Object
    • Control
    • Parent Object (if applicable)
  • User
  • OS Information
  • Access Information
  • and so much more!

about errors when they occur and can, amongst other things:

  • Log errors to a tables
  • Generate E-mails to notify the contact of your choosing when error occur supplying them with all the details, a Screenshot of the application and of the object involved

TheSmileyCoder has a 7 minute video on his site, or view it directly on YouTube by using the following link: Crash Report Tool – Demo, Setup and Instructions which briefly demonstrates the tool and the resulting error collection, e-mail, …

If you don’t have an error handling system yet, consider taking this one for a test drive. If you are new to the subject of Error Handling, you may also like to review my article MS Access – VBA – Error Handling.

If you do have a error handling system, consider taking this one for a test drive.  It truly adds some nice functionalities and makes error reporting much more user-friendly.

Note
I have no affiliation with above mentioned website, developer, product, company … The above is an independent, unsolicited post based on my personal opinion.

Update 2024-05-04: Since TheSmileyCoder’s site no longer exists, I have updated the links to point to an archived version of his site.

VBA Programming a Form or Report with Intellisense

I was introduced, by fellow MVP Ben Clothier, to a really nice way to code when defining a Form/Report object when referring to an existing form/report so as to gain intellisense for that database object.  You’re probably saying to yourself: “What is he talking about”, but bare with me for just a moment because it will be worth it!

Say you have a form name Form1 with various controls on it, with various properties, …

Up until relatively recently, when I was coding this with reference to a form such a s this I might use code along the lines of:

Public Sub SomeFunctionName()
    Dim frm                   As Access.Form

    Set frm = Forms![Form1].Form
    With frm
        '...
    End With
    Set frm = Nothing
End Sub

Now the above example works just fine, but one has to go back and forth between the actual form and the VBE to copy/paste control names, … to code.

Where it becomes truly fun is that with a very small change in code, one can gain the benfit of intellisense for the designated database object. Observe the following code:

Public Sub SomeFunctionName()
    Dim frm                   As Form_Form1

    Set frm = Forms![Form1].Form
    With frm
        '... Now, frm possesses Intellisense relative to Form1, coding just became much easier!!!
    End With
    Set frm = Nothing
End Sub

by declaring the variable frm as the specific form (As Form_YourFormName) you intend to work with instead of a generic Access.Form, you now gain Intellisense in the VBE for the designated form. Now control names, events, … are a keystroke away. This greatly facilitates coding, reduces typos, …

Similarily for reports you can do something along the lines of:

Public Sub SomeFunctionName()
    Dim rpt                   As Report_Report1

    Set rpt = Reports![Report1].Report
    With rpt
        '... Now, rpt possesses Intellisense relative to Report1
    End With
    Set rpt = Nothing
End Sub

Try it out and see for yourself how it makes your coding life a little bit easier!

Finally a Fix for the Images not showing in Forms and Report for Access 2016

It took several months, but Microsoft finally has released an official fix for the issue of images not showing on forms and reports in MS Access 2016.

Microsoft Installer (.msi)-based edition of Office 2016

It can be downloaded from Microsoft’s site at:

https://support.microsoft.com/en-us/kb/3114379

Office 2016 Click-to-Run editions

It took a few extra days, but the fix has finally been ported to the Click-to-Run editions as well.

File -> Account -> Office Updates -> Update Now

I haven’t taken the time to test out either yet, but should it ever fail, you can always try one of the original workarounds proposed in: http://www.devhut.net/ms-access-missing-images-images-not-showing/, but hopefully this will be the end of this dreaded issue.