I am sorry I didnot show the query i am using right now. This is how it looks:
SELECT Companies.ClientId AS Companies_ClientId, Companies.[Business Name],
Companies.[Bus Desc], Companies.LLC, Companies.SCorp, Companies.CCorp,
Companies.Partnership, Companies.[Inc Adr], Companies.RA, Companies.[RA-St],
Companies.[RA-St2], Companies.[RA City], Companies.[RA State], Companies.[RA
Zip], Companies.[RA-Phone], Companies.[RA-SSN], Companies.EIN,
Companies.County, Companies.[State of Inc], Companies.[Pr Office-St],
Companies.[Pr Office-City], Companies.[Pr Office-State], Companies.[Pr
Office-County], Companies.FY, Companies.[Date Bus Commenced],
Companies.[Stock-Single Class], Companies.[Stock-Auth],
Companies.[Stock-Multiple Class], Companies.[Class 1], Companies.[Class 2],
Companies.[Class 3], Companies.[Auth No-1], Companies.[Auth No-2],
Companies.[Auth No-3], Companies.[Shares Issued], Companies.[SH-Shares
Issued] AS [Companies_SH-Shares Issued], Companies.[Date Shares Acquired] AS
[Companies_Date Shares Acquired], Companies.[Sign Title], Companies.[Term
Date/ Dissolved], Companies.[Closing Date for LP/LLC], People.ClientId AS
People_ClientId, People.FirstName, People.[Last Name], People.Director,
People.Pres, People.SH, People.[SH- Name/Adr], People.[SH-SSN],
People.[SH-Shares Issued] AS [People_SH-Shares Issued], People.[Date Shares
Acquired] AS [People_Date Shares Acquired], People.[SH-Tax Yea],
People.Treasurer, People.Sec, People.Organizer, People.MGR, People.GP,
People.LP, People.Address1, People.Address2, People.City, People.State,
People.Zip, People.Phone, People.Fax, People.Date INTO test
FROM Companies INNER JOIN People ON Companies.ClientId = People.ClientId;
I just created this query as a test. that is why you see all the fields. But
when i ran the query i found the problem of two rows.
-------------------------------------------------------------------------------------
Now I am trying to implement what you suggested in your last response:
* Create new relationships between the Companies table and each of the
Contacts tables. Specify that each should include all records from Companies
table and only matching records from the Contacts table.
-----please let me know if this is way it will be done in the desgin view, I
see three tables. I deletd the earlier relationship between Companies and
contact(which is people table). Now to create new relationship: in both the
tables i have Client ID as the common field only in People, People 1 and
companies table.......
How will I a create the relationship that each field in companies table
should be in people, People1/contacts/Contacts1........
It might be my lack of understanding......
Thanks
*
JonOfAllTrades said:
SL said:
Thank you for replying.
there are two tables:
Companies table
People table
i run a query which pull the info from both the tables and put it in query
table. I use this query table in mail merge code/
Companies table and people table are linked with Client ID fields
So when a pull the results with select query, i get something like this
Company Name, Client ID, address, Directors, Oweners, Full Name Etc.....
AAA 1 Xyz YEs Yes WQR
AAA 1 XYZ YES No QAS
Like this .........
Result come in two rows. For mail merge i need the whole record in one row.
Also I need the full name for directors, owners and other officers in that
single row..... Is there any way I can do this all .....
I am passing the ino through a Form which has both people and COmpany table
fields
For Mail merge I am using following code:
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and Settings\S\My Documents\test",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the current database.
objWord.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE test", _
SQLStatement:="Select * from [test]"
' Execute the mail merge.
objWord.MailMerge.Execute
I donot know anyother easy way which involves less programming to update a
contract made in word from access/
Any help will be highly appreciated
Thank yu
That helps a little. If I understand you right, you want one Word document
for each Company, and the document should list the Director and Owner for
that Company.
I'm working blind here, without knowing exactly how your tables are
arranged, but hopefully you can use this as a starting point.
* Create a query in design view, with your Companies table and two copies of
the Contacts table.
* If you have an existing relationship between the Companies table and the
Contacts table, click it and hit delete (we're talking about the relationship
as it appears in your query, NOT the permanent relationship you see with View
| Relationships).
* Create new relationships between the Companies table and each of the
Contacts tables. Specify that each should include all records from Companies
table and only matching records from the Contacts table.
* Drag the fields you want into the table part of your query. Include the
Name field from each Contacts table, and include the Director field from one
table, the Owner field from the other.
* Change the Field from Name to DirectorName: Name for the first Name;
change the other one to OwnerName: Name.
* Set the Criteria to Yes for Director and Owner.
If you're familiar with SQL, this is what it should look like:
SELECT
Companies.Name, Companies.Address, Director.Name AS DirectorName, Owner.Name
AS OwnerName
FROM
(Companies LEFT JOIN Contacts AS Director ON Companies.ID = Contacts.ID AND
Contacts.Director = Yes) LEFT JOIN Contacts AS Owner ON Companies.ID =
Contacts.ID AND Contacts.Owner = Yes
Your result should be one row for every company, whether they have zero,
one, or two officers. If instead what you want is one record per Person,
you'll need something a little different.
If this doesn't work for you, let me know. It would also help if you posted
the SQL of the original query, and a list of relevant table and field names.