Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2008, 11:40 PM
Registered User
 
Join Date: Jun 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default need code for single mailmerge -- thanks!

I know I should be able to figure this out on my own, but this newbie's brain is too full at the moment so I'm asking for assistance.

Here's what I need:

I have an Access form with two comboboxes: One for selecting a client ID and the other for selecting among the titles of various Microsoft Word templates that contain fields corresponding to the fields in the client table in Access. (The former list is actually pulled from the related client table in the Access database; the latter list I just typed in myself, with the titles matching the titles of the Word templates that I keep in a separate folder.) There is also a GO button.

What I would like to happen when the GO button is clicked, it that the selected client's information gets merged with the selected Word template all in one step. (In other words, I don't want the user to have to choose the correct client record as a second step once they arrive at the Word template -- I want it to happen all as one step, ready for printing.)

I know in theory how this should work, but I don't know enough VBA vocabulary yet to write the code myself. Hoping someone out there can help me with this!

Kimber



 
Old June 26th, 2008, 10:38 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I'll give it a shot.

From what I recall, Word will only merge with an Access table, not with query results. So I would create a merge table with the fields you want, then do this on the GO button:

Run a delete query on the merge table
Run an Append query using the ClientID as a parameter.
   Create an append query with the appropriate fields,
   then in the ClientID column add this,
     [Forms]![frmMyForm].[cboClientID] or whatever the name of the form and control is.
Then launch Word.

Do you need more help?



mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old June 28th, 2008, 09:43 AM
Registered User
 
Join Date: Jun 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks -- I'll give it a try.

Kimber

 
Old July 17th, 2008, 09:48 PM
Registered User
 
Join Date: Jun 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Worked like a charm! Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Single Typo in 'Final' VB Code - causes 37 errors irelandk BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 May 3rd, 2009 02:30 PM
MailMerge with .dot FROM Access Loralee Access 2 February 27th, 2006 11:47 PM
PHP and Mailmerge Mantis Pro PHP 1 August 23rd, 2005 11:39 AM
Single crmpicco Excel VBA 2 May 10th, 2005 03:57 AM
ASP.Net Single Single-on with Oracle Application S guhanath Oracle 0 October 6th, 2004 05:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.