Not another ms-access page!
Albert D. Kallal

The ms-access stuff on this page is only a temporally placement. I really think that there is a good many quality ms-access web sites out there. In fact, there are so many of such a good quality, that I really don't think it is in the interest of the access community for me to start another start another one!

Thus, I am currently in the process of finding a home for this stuff.

I do however have a number of interesting articles about using ms-access, and they can be found at my home page:  HOME

Ms-access stuff:

Printer change code.

This code simply allows you to change the default printer in code via ms-access. It is MINIMAL CODE.  This code is both minimal in the size, and the also the ease in which it can be integrated into your application. It only requires one module, and has a couple of functions. That is it. Make sure you read the comments in the code module for how to use.

Access97: click here for printer change code.
A2000    : click here for print change code.

You can simply pass the name of the printer you want to change to. Nothing else is required.

If you need to control more than just the default printer, then I would suggest you use the code at:

This code very complex, and requires you to deal with quite a bit more than just a simple printer string name (you have to save the "port", "driver" *and* the name). Just the constant defs file is 100 lines of code, and in fact more than all of my code in the printer switch module!. It requires about 4 modules.  It does allow you to control more than just the printer to switch to.  If you need more than just a simple printer switch code, then check it out. There is a lot of info contained there, and if you are looking for advanced printer info, it is a real gem. It does have some problems in that it does not correctly update the default printer in the printers folder.

For access 2002 and later:

In access 2002 and later, there is a built in printer object, and it lets you switch the printer with ease.

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

The above means you don't need my printer switch code.

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

So, for later versions of ms-access, you don't need a bunch of extra code!!!

By Pass Shift Key Code

This code simply lets you browse to a mdb database of your choice, and enable, or disable the shift key during the startup of the mdb/mde.

Access97:    click here for shift key code

A2000:        click here for shift key code

Super Easy Word Merge.

Finally, some code to stop the crazy solutions to merging a single record in ms-access to a word document. Like everyone else, I asked why does this have to be so hard?

I also have a very high dislike of bookmarks, since end users can not possibly be expected to work with them when trying to create a template. My above approach is so slick, that your END USERS in most cases can figure this out WITH NO training.

In addition, this code is late binding, so it works even if your version of ms-word is different then that of ms-access.

How to use:
Simply merge the 2 forms and 2 modules of code into your application. Then place a button on you ms-access form with the following ONE LINE code.


That is it!! You are done!.  Now, just hit the "add new template" button to create a word template". Now insert your merge fields, and SAVE the document. Next, just try hitting the word merge button again. This is way cool, and easy. I will write up some better instructions, but I have included a sample form for you to try.

Note that if you do import the code into your a2000 application, then you MUST set the
"Microsoft DAO 3.6 Object Library" in the references window.

Access97     :    click here for  access 97  merge code

Access2000:    click here for access 2000 merge code

Update: Feb 14, 2004. I have modified the above merge example to work with office 2003. I your version is before Feb 14, 2004, then you want to re-load the above software.

For some screen shots and some more notes on using this merge code please click here Merge notes.

Lines of code.

This little piece of code will count all lines of code in your application (it does include blank lines). It also gives you a count for forms, tables, queries etc. This is VERY rough code, and is not a at all for end users. Simply import the one module into your application and  save + compile your application. Then whack ctrl-g to get to the debug window, and type in


You will see each form, report load, and close (a lot of screen flashing). When done, you can look at the results in the debug window (make a copy of your application to test this on!).

Access97       : click here for the code

Multi Select Example.

This little example shows you how to select multiple items from a form, and then send it to report. The nice feature of this example is that it does not use a actual field in the database to accomplish this.

I have not yet written this one up...but the code involved is VERY simple.

Access2000       : click here for the code

Inventory Stock Example:

This example is simply here because I needed to show someone how to calculate stock on hand from inventory. This example quires 125,000 orders records joined against inventory, and figures out the on hand stock in LESS then 2 seconds on a average computer. (the file is zipped, and thus is less then 2 megs in size).

Access2000       : click here for the stock example

Access2000       : click here for stock example - with sample forms (but almost no data)


WinZip for MS-access

This routine and library allows you to create win-zip compatible files. There is no need to install the software. All that is required is you place the two .dll's files in the SAME directory as your mdb/mde file, and the same code will zip, and un-zip files for you.

Click here for my access zip page

Some neat comments and screen shots of ms-access stuff:

Grids in ms-access:

Looking how to display data as a grid in ms-access? Then take a look at the following screen shots as I show the use of list box, and continuous forms

Some grid examples

Searching in ms-access:

My thoughts on how to search for something in ms-access.

Search screen shots

Dialog prompts in ms-access.

Dialog and model forms are most often confused. Here is how to use them

Making Dialog Prompt Forms


Add decompile, and compact to the right click in windows expore for access 2003

click here

Access 2003 registry edit to set security = low

click here

Access 2007 ribbon class code enable/disable example

click here

Instructions for the ribbon class can be found here: Ribbon Class object

more downloads click here