I'm looking to print off a booking form based on the data in 3 linked tables by merging it in Word. Please if you know of a better way, let me know.
Bookings table contains summary, cost, breakdown of cost, booking id, client id
Clients table contains clientid, name, address, phone
Sessions table contains date, time, activity, booking id
So one client books many sessions through one booking.
I can make a query that can be easily merged to Word containing the boooking and client information, but how can i include the many sessions that comprise one booking?
My attempts so far have produced a new doc for each session, ie. too many.
It seems Word won't link to more than one query at a time, but I can't make one query return all the info per line that word would require?
help?
7 1890 maxamis4 295
Recognized Expert Contributor
I am looking into your solution, i know it has been done, but never really had to do it my self. I have always been a fan of crystal reports or even the access reporting tool that comes with it. Have you tried creating a report in MS Access that looks like the word document? If it needs to be done in word, it is completely understandable.
let me know
I'm looking to print off a booking form based on the data in 3 linked tables by merging it in Word. Please if you know of a better way, let me know.
Bookings table contains summary, cost, breakdown of cost, booking id, client id
Clients table contains clientid, name, address, phone
Sessions table contains date, time, activity, booking id
So one client books many sessions through one booking.
I can make a query that can be easily merged to Word containing the boooking and client information, but how can i include the many sessions that comprise one booking?
My attempts so far have produced a new doc for each session, ie. too many.
It seems Word won't link to more than one query at a time, but I can't make one query return all the info per line that word would require?
help?
maxamis4 295
Recognized Expert Contributor
go there
[Link Removed]
I am looking into your solution, i know it has been done, but never really had to do it my self. I have always been a fan of crystal reports or even the access reporting tool that comes with it. Have you tried creating a report in MS Access that looks like the word document? If it needs to be done in word, it is completely understandable.
let me know
MMcCarthy 14,534
Recognized Expert Moderator MVP
Sorry Maximis4 linking to competing forums is frowned on.
ADMIN
Sorry Maximis4 linking to competing forums is frowned on.
ADMIN
That's all very well but by redirecting me to a solution someone else has written rather than writing it out again he's just using good db protocol and normalising the whole affair.
So I missed the link you posted, any other ideas?
MMcCarthy 14,534
Recognized Expert Moderator MVP
That's all very well but by redirecting me to a solution someone else has written rather than writing it out again he's just using good db protocol and normalising the whole affair.
So I missed the link you posted, any other ideas?
Sorry I do understand. But I'm sure maximis4 will be able to help.
MMcCarthy 14,534
Recognized Expert Moderator MVP
maximis4 the rule on this is...
You can copy in the solution and give full credit to the original poster but you can't provide a link to the site, sorry.
Mary
maxamis4 295
Recognized Expert Contributor
I apologize for the link. You will have to do this in 4 steps
FIRST CREATE MODULE, NAME IT ANYTHING YOU WANT. COPY THE CODE BELOW INTO IT -
Function CreateIt()
-
-
-
Dim WordObj As Word.Application
-
Dim db As Database
-
Dim rs As New ADODB.Recordset
-
-
Set WordObj = CreateObject("Word.Application")
-
Set db = CurrentDb()
-
Dim ID, Criteria
-
-
With WordObj
-
.Visible = True
-
.Documents.Open ("C:\MyWord.doc") ' ** name and path for the document
-
-
rs.Open "Customers", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
-
Criteria = "[CompanyName] = " & "'" & Forms!WordDemo!CompanyName & "'"
-
-
ID = DLookup("CustomerID", "Customers", Criteria)
-
-
rs.Find "[CustomerID]=" & "'" & ID & "'"
-
-
.ActiveDocument.Bookmarks("CoName").Select
-
.Selection.TypeText rs.Fields("CompanyName")
-
-
.ActiveDocument.Bookmarks("Address").Select
-
.Selection.TypeText rs.Fields("Address")
-
-
.ActiveDocument.Bookmarks("City").Select
-
.Selection.TypeText rs.Fields("City")
-
-
.ActiveDocument.SaveAs "C:\NewDoc.doc"
-
End With
-
-
rs.Close
-
Set rs = Nothing
-
Set WordObj = Nothing
-
End Function
-
Now before moving forward you need to understand that this works on the concept of bookmarks in word. Research those if you don't know how to use them. In your orginial document I recommend you create a template with bookmarks at ever insertion point where you want your document to have database data. For example like a mail merge create a bookmark called 'Last Name' which will create the document with a particular last name.
STEP 2 CREATE YOUR WORD TEMPLATE
STEP 3 CREATE A FORM WITH A BUTTON LIKE THE ONE LISTED BELOW -
Private Sub MoveIt_Click()
-
On Error GoTo Err_MoveIt_Click
-
Call CreateIt
-
-
Exit_MoveIt_Click:
-
Exit Sub
-
-
Err_MoveIt_Click:
-
MsgBox Err.Description
-
Resume Exit_MoveIt_Click
-
-
End Sub
-
Now please under stand this will export any field you want. it all depends on queries that you write or the methods that you pass data.
STEP 4 MAKE SURE YOU HAVE THE MS WORD LIBRARIES PRESENT ON YOUR DATABASE.
you can finde the reference libraries under tools references in the code view. by default word should be in there, but i have seen times where it doesn't work.
I can email this example which I retrieved from Utter Access, but the rest of the development I leave in your hands.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dan Nash |
last post by:
Hi guys
I wonder if you could help. I'm trying to create a bespoke interface for
mail merging from an Access database in Word. At the moment, I'm just trying
it with CSV files, and it works. Word loads, data gets pasted in and it
merges fine. One problem tho, it's doing Form Letters rather than Mailing
Labels
Here's the code...
|
by: rottyguy70 |
last post by:
hello, am trying to do the following with little success. any help is
appreciated.
1) assume i have a static mapping:
a -> 1
b -> 2
c -> 3
2) i need to read through some data, let's say set and create
|
by: Jerry Hull |
last post by:
I'm working with a database developed by an untrained person over
several years - and on a network that has recently been upgraded with
a new server installed and MS office upgraded from 2K (I think - it
might have been XP) to 2003. The database is impressive, both in what
it does and the obtuse and inconsistent ways it works. There are
several hundred queries, for example, with no indication of where they
are used or if they are in fact...
|
by: svdh |
last post by:
I have posed a question last saturday and have advanced alot in the
meantime. But I am still not there
Problem is that I try to merging various fields from various tables in
one document in Word
1. Query..I want to keep the fields seperatred. I do not want to sent
on field with all accumulated languages from one person to Word. Each
language should appear in the document in a separate cell
Cross tables are not delivering the result I...
|
by: mharris |
last post by:
I need help with merging two Word documents into one through C#
code. The problem isn't so much getting the documents put into one as
it is maintaining the appropriate formatting, or rather reformating,
after the merge. This is a full description of my needs.
I have a C# class library that creates two Crystal Reports, and then
exports them to the harddrive as Word documents. One's orientation is
landscape, the other is portrait. I then...
| |
by: Paul H |
last post by:
I have a very simple database containing one table called "tblProducts". The
fields are: ProductID, Description, Price.
I have a folder on my PC that contains image files. The image file names are
based on the associated ProductID, i.e. 2001.jpg is a picture of ProductID
2001.
I know how automate Word mailmerge using VBA in access, but I want to
include the related pictures in the merged document. So the word doc will
have a table in...
|
by: babyangel43 |
last post by:
Hello, I have a query set up in Access. I run it monthly, changing
"date of test". I would like this query to be merged with a Word
document so that the cover letter is created in Word, the fields from
Access are automatically filled into the Word document. The query
could be anywhere from 0-5000 names, one cover letter per name. AND to
this cover letter for each applicant, there has to be attached a two
page document. How in the world can...
|
by: =?Utf-8?B?QmFkaXM=?= |
last post by:
Hi,
I'm trying to do mail merging in C#.NET and in one methods:
Word.Application wrdApp;
Word._Document wrdDoc;
Object oMissing = System.Reflection.Missing.Value;
Object oFalse = false;
private void FillRow(Word._Document oDoc, int Row, string Text1,
|
by: =?Utf-8?B?QmFkaXM=?= |
last post by:
Hi,
I'm trying to follow a mail merging example in C#.Net that I got from:
http://support.microsoft.com/default.aspx/kb/301659
and in one the methods:
Word.Application wrdApp;
Word._Document wrdDoc;
Object oMissing = System.Reflection.Missing.Value;
Object oFalse = false;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |