473,503 Members | 12,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query as data source for mail merge

I have a query named QryDept where one of the fields is DeptID. The query is
used for the data source of a mail merge letter. I would like to control
which department is to get the mail merge letters. I have a department
selection pop-up form where the departments are listed in a listbox. The
value of the listbox is DepartmentID. On the form is a Create Mail Merge
button which is coded to open the mail merge and make the pop-up form not
visible. In QryDept I set the criteria for DeptID as
Forms!MyPopupForm!DepartmentID. When I go to Word to create the main
document for the mail merge, it won't let me set the data source as QryDept.
If I remove the criteria in the DeptID field, it will then let me set the
data source as QryDept but if I run the mail merge that way I get letters to
all departments. If I go back to QryDept and enter the criteria after making
it the data source, I get an error message when trying to run the mail
merge.

Has any one else experienced this problem? How can I set the criteria in the
data source query for a mail merge?

Thanks!

Lisa
Nov 13 '05 #1
1 3115
Well, you could download my mail merge program. Remove all criteria from the
query.

Then, place a button in your popup form that lets the user select the
department.

Then, the button code on that popup form to merge would go:

dim strSql as string

strSql = "select * from qryDept where DeptID = " & me!DepartmentID
MergeAllWord strSql

That is all you need!

You can try downloading my sample mail merge code and system here:
http://www.attcanada.net/~kallal.msn.../msaccess.html

Give the download a try..and see if you like it. If the working sample is to
your lining, then you can read the notes on how to use this merge in your
application. Once my code system is in place, you can see that you only need
about 3 lines of code to do the whole mail merge...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2360
by: Julia Baresch | last post by:
Everyone, I posted the message below back in February and didn't get any information. I also wasn't able to find any documentation in MS Help, web site, or other groups. I'm posting now with...
1
2323
by: Norbert Lieckfeldt | last post by:
MS Access 2002 here. I am just trying to set up a simple database for a friend who's an optician. Basically, all clients with address details, date of last eyetest and a drop-down combo box to...
3
3057
by: Lynn A. | last post by:
Access/Word 2000 I am trying to merge a word document with an access query that has a parameter attached to it. Could someone please suggest how to stop the parameter from appearing when the...
6
8133
by: Sven Pran | last post by:
Probably the answer is there just in front of me only awaiting me to discover it, but: 1: I want to build a query that returns all records in one table for which there is no successful "join"...
1
1366
by: maiden_moon | last post by:
I need to take specific data from a access db and merge it with a word doc. I know how to do the general mail merge using access and word, but for this I need the user to enter peramiters for the...
0
2760
by: Phil C. | last post by:
Hi, I'm using Access 2000. I have a Select Query that uses the MID function to separate the actual text of articles from the title of the articles. The articles are enterd into the...
0
8641
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
1
1519
by: Bhujanga | last post by:
I am creating letters from selected Access records using a Mail Merge document in Word. The mail merge document gets its data from a one-record table that is created from a Make-Table query that gets...
2
1896
by: zazu | last post by:
We have a query which is used as a mail merge source in Word. No problem. However we made it a parameter query and when trying to establish the link between the query and the word document in the...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.