473,769 Members | 8,267 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!MyPopupFo rm!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 3133
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
2382
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 results of my research in case anyone else might need this information. I consulted with my MIS colleague, and he said it would be ok to have each merge file pull the whole database when the criteria screen is opened. His reasoning was that it...
1
2346
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 choose a number of months to the next eyetest (3,6,12,24). I then have a calculated field in the form which works out the date of the next appointment on the basis of the previous two sets of information . All that works . I am now trying to set...
3
3076
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 query runs. I think it might have something to do with the source document mailmerge.doc. Could it be that I'm trying to run the query from
6
8164
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" in another table but I have not found what the field criteria should look like? 2: And if/when I succeed I should further like to build a new record (with
1
1380
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 query that the merge is run from. If you run the query in access it askes the user to enter a case number, thus receving records ONLY for that case. If you use this query for the merge in word, it never askes for the case number and
0
2768
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 underlying table (in a memo field) in html format, as one big block of text. The memo field is called (I named it before I realized that I needed to separate title from text).
0
8673
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 with others. I have seen many request for information on mail merging an how to send data to word documents this is something I have put together with the answers given by others and I hope this will help a few newbies , I know there are easier ways...
1
1533
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 run when the command button that opens the letter is run. In this query there is a prompted field, i.e. the query asks the user for the value that is to be placed in the field. The query runs fine and the table is created successfully and the...
2
1909
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 Data Source window this query did not appear in the list of Access tables. Deleted the parameter and reverted to Select query and there it is in the Data Source window. Can any body explain this please and also comment on whether a parameter...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
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 we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.