473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Mail merge from form - with matching ID.

Hope this is in the right place.

I have an Access form which allows the user to look through appointments, each appointment having a specific ID.

I would like to place a button on the form that will open a mail merge document in Word, with the Appointment ID corresponding to the ID of the current record when the button was clicked on the form. Make sense? I hope?

Like, on the form, the details of Appointment 380 will be displayed, and when the user clicks the mail merge button, an invoice will open in Word with the required details of Appointment 380.

I have already created the Word document based on an appointment query, but it lets me cycle through all the appointments, I need just one to be displayed. I just need to know how to link it to the form somehow.

Thanks, hope this made sense.
Jan 22 '10 #1
4 2176
nico5038
3,080 Expert 2GB
Just change the query to filter for the value of the form or create an additional table with one row holding the ID and fill/update that value when selected in the form and JOIN your query to this table.
Finally a public variable could be used too.

Nic;o)
Jan 23 '10 #2
I tried the first thing you said, putting [Forms]![AppointmentForm].[ID] as the query criteria, but I keep getting errors about the database being in a locked state by "Admin" whenever I try to open word. I think I'll just leave it, thanks anyway.
Jan 23 '10 #3
nico5038
3,080 Expert 2GB
Using the Table with one row option is easy to realize, just create a table (e.g. tblID) and add one row.
Now place in the OnCurrent event of the form:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("UPDATE tblID SET ID=" & Me.Id)
In the mail merge query add a JOIN of the ID with this table and try again.

Nic;o)
Jan 23 '10 #4
NeoPa
32,556 Expert Mod 16PB
@HappyGlassify
I suspect this is due to your having the database open (and having some object in design mode - probably to look at the code) at the time. To test this you would need to run it without being in design mode at all.
Jan 24 '10 #5

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

Similar topics

2
by: Steve M | last post by:
I'm trying to do invoke the mail merge functionality of MS Word from a Python script. The situation is that I have a template Word document, and a record that I've generated in Python, and I want...
1
by: Lisa | last post by:
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...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
0
by: Linda Cacina | last post by:
Hello all you fine folks, Here is some code I am using to merge data from a single record Access 2K3 table into a NEW word document based on a pre-defined Word merge template doc. All I want to...
5
by: Simon | last post by:
on my database i have a customers Table (tblCustomers) on the form of it (frmCustomers) i would like a button what will open up word and open up my comapny letter head template and then merger...
8
by: Ron B | last post by:
Help!!! What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table. I want to...
1
by: mr k | last post by:
Hi, I wanted to use mail merge with forms but Text form fields are not retained during mail merge in Word, I got the code from Microsoft but it doesn't remember the text form field options such as...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date...
1
by: kayberrie | last post by:
I want to write a VBA mail merge code. I want to link the code/macro/dohicky to a nifty little button so it makes life easy. I think I can handle the button part, the code part - not so much. I know...
3
tdw
by: tdw | last post by:
Hi all, I am trying to create an Access database for use purely as a more efficient way to enter fields into a Mail Merge for a friend who is an attorney. Currently, I am using Word's mail...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.