473,491 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I create a single form letter for individual data

emandel
65 New Member
OK I am an amateur and your patience is appreciated.

I have a database of Donors with their donations. I want to create a button (macro <?>)on my donation form that will automatically open a document in MS Word that will thank the donor for that specific donation. So this is something that I will do as the donation comes in. one donation in, one letter sent. The key is that I don't want a new query (e.g. query all donations in the past week) I want to do it in real time, but have the mail merge document ready to go, and just press the button. Does that make sense?

Thank you
Jul 23 '10 #1
6 3804
NeoPa
32,556 Recognized Expert Moderator MVP
I'm not very good with Word to be fair, but I think MailMerge requires the selection of the data to be controlled from Word itself. It's a Pull of data rather than a Push from the source if you like. I expect you could use Application Automation to get Word to do what it needs. As I say, I cannot help much there.
Jul 23 '10 #2
hansnext
6 New Member
A way to do this would be to create a report based on a query which uses the ID of the current record in its WHERE clause and with the boiler-plate text of your form letter as a label on the report. Include the donor's details (name etc.) in the query and then you will be able to place it on the report. The button on your form would run the report to acPreview and then you can just use the Export to Word function from the tool-bar to get it into Word. You can do more elaborate things with application automation but if you are doing this record by record you probably don't need that much.
Jul 23 '10 #3
emandel
65 New Member
@hansnext
"which uses the ID of the current record in its WHERE clause" can you explain this sentence? I am not understanding it.

Thanks.
Jul 23 '10 #4
emandel
65 New Member
@emandel
sorry for bumping back up, but I am still very unclear as to how to do this.
Jul 25 '10 #5
NeoPa
32,556 Recognized Expert Moderator MVP
emandel: "which uses the ID of the current record in its WHERE clause" can you explain this sentence? I am not understanding it.
I expect this is referring to opening the report with a filter (WhereCondition parameter of the DoCmd.OpenReport call).

For some examples on how to build up a filter string see Example Filtering on a Form.
Jul 25 '10 #6
hansnext
6 New Member
"which uses the ID of the current record in its WHERE clause" can you explain this sentence? I am not understanding it.
Apologies if I was obscure - NeoPa's post is what I meant. You just write the query with the fields you want in the letter, then the report with the boilerplate text and the fields (such as client name & address)from the query. Then on the form where the users sees the individual record you put a button with code LIKE this behind its OnClick event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub buttonPrintIndividual_Click()
  2. On Error GoTo Err_buttonPrintIndividual_Click
  3.     Dim strReportName As String
  4.     Dim whereClause As String
  5.     strReportName = "rptStandardIndividualLetter" 
  6. 'Get the ID of the current record from the form  
  7.     whereClause = me.RecordID.value
  8. 'Check that there is a current record
  9.     If whereClause  <> "" Then
  10.     DoCmd.OpenReport strReportName, acViewPreview, , whereClause 
  11. Else
  12. MsgBox "There is no current record"
  13. Docmd.cancelevent
  14. End if
  15. Exit_buttonPrintIndividual_Click:
  16.     Exit Sub
  17. Err_buttonPrintIndividual_Click:
  18.     MsgBox Err.Description
  19.     Resume Exit_buttonPrintIndividual_Click   
  20. End Sub 
I say LIKE this because I have not tested this code although I have used similar. In effect the query and report you write will return all of the records, but when you pass the WhereClause on the OpenReport event it filters the recordset for the report down to just that record that matches the ID of the record that is current in the form. I hope that is clearer?
One other point - I have found that you cannot guarantee that when an Access Report is exported to Word that the formatting in Word exactly matches what you would see if you printed the report directly from Access. In my experience it is a waste of time to put any effort into layout, graphics or lines in a report as they get lost or wrecked in the export to Word. Simpler is better. Of course you could just print the letter from Access assuming you are sending snail-mail.
Jul 28 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2023
by: vishal | last post by:
how can i create a form which is when submitted calls itself i mean what to write in action property of form element thxs
1
2390
by: jbroome | last post by:
I have several tables that contain the same information as Identifying records but then with additional info that differs from table to table. e.g. 1 database of school students with their...
2
1599
by: JLeonard | last post by:
I would like to save my Access form letters as a txt file who's file name matches the value in a 'last name' field. One file for each record. Any ideas for how I might do this? Thanks in...
0
1171
by: KB | last post by:
I am creatig a database in 2000 where I need to be able to have the users add data and information into lookup tables. That is no problem, I have a form for that, that works fine. This...
6
2462
by: skgolden | last post by:
My husband and I own a small temporary labor company and deal with 4 major clients (A,B,C & D), each of which has about 2 dozen units in our tristate area that we deal with (ie, Company A, units...
2
5203
by: timcos | last post by:
I have a database...flat as it is...a database no less. I would like it to create form letter (actually they are contracts) but the idea is the same. I would like to use a report or a form to...
2
1268
by: simon | last post by:
Hello in my codebehind for a user preference form, i instantiate a new class, and then call a function in that class. the function calls a proc which returns a dataset (in this case a single row...
2
3353
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to...
1
2100
by: Dean0621 | last post by:
Good morning folks, as with most people on here with their first time question, I have been working on this issue for nearly two weeks, doing some searching on this forum and the internet to assist...
3
1889
by: RLN | last post by:
I have an app that will send out an email periodically. My table has one row and three columns: a primary key, an "EmailFrom" Address and an Email template. The template is the text of the...
0
7154
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,...
0
7190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6858
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
7360
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...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
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
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1392
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
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.