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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 | |
|
|