|
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.
MergeSingleWord
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
LinesOfCode 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) |