A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Super Easy Word Merge onto multiple tables?



 
 
Thread Tools Display Modes
  #1  
Old October 5th, 2006, 08:44 PM posted to microsoft.public.access.forms
CW
external usenet poster
 
Posts: 701
Default Super Easy Word Merge onto multiple tables?

I posted my problem a few days ago and Wayne had a suggestion but it has not
resolved it - here goes again:
I have a Main form and several tabbed pages and a couple of subforms. Each
of these is based on a different table.
When I use the Merge on the Main form all is well, because it only has to
look at that table and I can get the necessary mergefields working fine.
But when I add the Merge button to any other page (form) and try to create
templates based on the fields in those pages, it will still only see the
table underlying Main, it will not allow me to see the tables and fields
relevant to those other pages.
I tried Wayne's suggestion and created a query incorporating all the fields
that I would want to use in the various document templates and then created a
form based on that Query.
That worked fine on its own. But when I added that as a subform into one of
the other pages, having created the necessary child link so that the specific
record could be read, I'm back to the same old problem again.
This is a real pain - I WANT to use this great feature on my various forms,
picking up the data from several tables at once and merging into a variety of
docs.
Is Albert around, please - if anyone, I'm sure he will know!
Thanks a lot
CW
Ads
  #2  
Old October 5th, 2006, 09:02 PM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default Super Easy Word Merge onto multiple tables?

I tried Wayne's suggestion and created a query incorporating all the
fields
that I would want to use in the various document templates and then
created a
form based on that Query.
That worked fine on its own.



But when I added that as a subform into one of
the other pages,


What do you mean by "added that"??? Why are you adding ANYTHING to a
sub-form? The suggestion was to use a query that pulls in all of those
fields that you need.

You can then specify the query for a merge in palce of the merge
automatilcay using the current form filds.

(RTFM) - here
http://www.members.shaw.ca/AlbertKal...rge/page2.html


eg:

dim strMySql as string

strMySql = "select * from MyWayCoolQueryWithAllFields where id = " & me!id

MergeAllWord strMySql

So, continue to launch the merge from the main form, but just use that query
you built with all of the other fields included. when you do the above, the
query with all of the extra fields will be available in the merge...

I suppose if you wanted to, you could base the form on that huge query also,
but I don't think that makes sense, and the above is only one extra line of
code anyway....

The only problem I see here is "WHICH CHILD record" do you want to choose in
these cases. (or, are all of the sub-forms (child tables) always only one
record?).

If you need to restrict the merge to a particular sub-form record, then
place the merge button on that sub-form, and go:

dim strMySql as string

strMySql = "select * from MyWayCoolQueryWithAllFields where ChildID = " &
me!ChildID

MergeAllWord strMySql

So, the above sql string would restrict the query to the ONE child record.
But, of course that child record will still include all of the main forms
fields. I don't think I saw your other post, but you not explained *how* you
plan to choose (select) which child record to be included in the merge?

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 OfficeFrustration.
The comments are property of their posters.