By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

Mail merge from form - with matching ID.

P: 6
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
Share this Question
Share on Google+
4 Replies


nico5038
Expert 2.5K+
P: 3,072
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

P: 6
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
Expert 2.5K+
P: 3,072
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
Expert Mod 15k+
P: 31,299
@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

Post your reply

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