473,657 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2007... Merge two tables

6 New Member
Thanks to all in advance...
I have two tables...
corporations...
ID corpname corpnumber address
1 widgets 123456 1122 3rd
2 acme 234567 123 4th st
3 engineers 345678 987 wall st
etc...

officers...
ID corpnumber type fname lname
1 123456 pres john baker
2 123456 dir joe blow
3 123456 sec jane doe
4 234567 pres mike jones
5 234567 dir suzy sayz
6 234567 sec paul north
etc...
I need 1 table similar to this...
ID corpname corpnumber address pres dir sec
1 widgets 123456 1122 3rd j.baker j.blow j.doe
2 acme 234564 123 4th m.jones s.sayz p.north
etc...
I've tried different relationships, changing PK's, union query, append query, etc... All I come up with is one officer per corporation...
Any help is appreciated.
Clint
Dec 19 '10 #1
15 4273
NeoPa
32,568 Recognized Expert Moderator MVP
Try creating a query with both tables included and using a LEFT JOIN from [Corporations] to [Officers] on Corporations.Co rpNumber = Officers.CorpNu mber.

You don't need a new table for this as the query will do all you should be thinking about with this data. Trust me on this. A new table would be a thoroughly bad idea (Or don't trust me and ask for reasoning - I'm happy either way).
Dec 20 '10 #2
Clint Nelson
6 New Member
NeoPa
Still nothin... Any Idea what my PK's should be? Should I have multiple?
Dec 21 '10 #3
Rabbit
12,516 Recognized Expert Moderator MVP
You're going to need a crosstab query to get the result in the format you're looking for.
Dec 22 '10 #4
Clint Nelson
6 New Member
Ummm. I don't want to or need to calculate anything... all I wanna do is sort the company officers(i.e. president, director, secretary) to the respective company into one record.
Dec 22 '10 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Which is why you would use a crosstab. If you're trying to consolidate multiple records into one record, then you have two options, a crosstab or 3 subqueries. A crosstab would be the quickest of the two options.
Dec 22 '10 #6
Clint Nelson
6 New Member
I am kinda new to this... so I am gonna read elsewhere on how to find the SUM of 10,000 last names or the AVG of 10,000 Cities.
Dec 22 '10 #7
Rabbit
12,516 Recognized Expert Moderator MVP
But you're not trying to find the sum/average of cities/names. All you need is the first(), last(), max(), or min() of the cities/names. You are assuming that a crosstab has to be the mathematical aggregation of numbers when that is not the case.
Dec 22 '10 #8
Delerna
1,134 Recognized Expert Top Contributor
Just to verify what as Rabbit says
crosstab is the easiest

I did a mockup db of your data

First you need a query to combine the 2 tables for the crosstab
Expand|Select|Wrap|Line Numbers
  1. SELECT corporations.corpname,
  2.    corporations.address,
  3.    officers.type,
  4.    [fname] & ' ' & [lname] AS Name
  5. FROM corporations 
  6. INNER JOIN officers ON
  7.    corporations.corpnumber =officers.corpnumber;
  8.  
I called it qryCorporationO fficers


Now make the crosstab
Expand|Select|Wrap|Line Numbers
  1. TRANSFORM First(qryCorporationOfficers.Name) AS FirstOfName
  2. SELECT qryCorporationOfficers.corpname,
  3.    qryCorporationOfficers.address,
  4.    First(qryCorporationOfficers.Name) AS [Total Of Name]
  5. FROM qryCorporationOfficers
  6. GROUP BY qryCorporationOfficers.corpname,
  7.    qryCorporationOfficers.address
  8. PIVOT qryCorporationOfficers.type;
  9.  
and the result is attached
Attached Images
File Type: jpg corp.jpg (26.5 KB, 266 views)
Dec 23 '10 #9
Delerna
1,134 Recognized Expert Top Contributor
oops, forgot to remove the total column
Here is revised crosstab
Expand|Select|Wrap|Line Numbers
  1. TRANSFORM First(qryCorporationOfficers.Name) AS FirstOfName
  2. SELECT qryCorporationOfficers.corpname,
  3.    qryCorporationOfficers.address
  4. FROM qryCorporationOfficers
  5. GROUP BY qryCorporationOfficers.corpname,
  6.    qryCorporationOfficers.address
  7. PIVOT qryCorporationOfficers.type;
  8.  
  9.  
Dec 23 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

49
4338
by: Allen Browne | last post by:
If you are looking for opinon on what's useful in Access 2007, there's a new article at: http://allenbrowne.com/Access2007.html Covers what's good (useful features), what's mixed (good and bad), what's gone (features removed), what's fixed (old issues solved), what's broken (new bugs), configuration, compatibility, should you buy, and links. It is opinion, so you may disagree, but hopefully it's an informative summary.
0
1274
by: nebbiasun | last post by:
I have a split database which calls a word document (mail merge from query) which works perfectly in both access 2003 and 2007. I have secured the frontend and backend (user level security) in 2003 also without problems. I have tried to migrate the same files to an access 2007 without success. I receive error messages that I don't have permission to access the frontend or OBDC login failures. I've played with this quite a bit and can not...
2
3788
by: ARC | last post by:
Just curious if anyone is having issues with Acc 2007 once the number of objects and complexity increases? I have a fairly large app, with many linked tables, 100's of forms, queries, reports, and lots of vba code. I'm nearly finished with re-doing my app in access 2007, and just imported an add-in program, which has added even more forms, queries and linked tables. Every so often now, after opening many different screens, I'll...
4
2249
by: TheScullster | last post by:
Hi all This must have been covered already, but Google (or my use thereof) is failing me! We have a company database originally created in Access 2000. The backend is located on a Win2003 server. The front end is on clients running Office 2003. The obvious question is.... will this front end work on a client running
2
15614
nico5038
by: nico5038 | last post by:
Access 2007 Linkedtable manager refuses to relink tables having a field with the "Attachment" datatype. Problem: When placing a split database in another folder, the Linked table manager should be used to relink the tables. The Linkedtable manager does however refuse to relink tables having an "Attachment" datatype field. Symptoms: Open the Linkedtable manager and select a linked table with an "Attachment" datatype field. Now try to...
6
8758
by: tony.abbitt | last post by:
I have recently installed Office 2007 (SP1) retaining the previous installation of Office 2003. I have converted an Access 2003 database to Access 2007. The database contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' to initiate the dialog box to rebuild links to tables held in a back-end Access database (which has also been converted from Access 2003 to Access 2007). The code runs without problem in the original Access 2003...
5
3012
by: WPW07 | last post by:
Hello, We have several complex applications developed in Access 2003 by various outside consultants. These applications link to a variety of Oracle tables and are used only for Access reports. User level security is also built in via the mdw workgroup file for all applications. I've been asked to research how viable it is to convert all of these applications to Access 2007. I understand 2007 discontinued user
3
6485
by: masonic35and7 | last post by:
I work for a school district, and I have just imported 6 Excel worksheets into Access 2007. Now I have 6 different tables. In each table all the fields are the same. I need the easiest way to merge all the tables into one huge table. There are at least 2,500 records per table if that makes a difference. I am unfamilar with writing any type of code, so please don't suggest that unless you can also tell me how to do that. Thanks
9
4485
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd like to know is the stability, speed & ease of use of both the products. I believe Access 2007 has a new file format too and that it may be slower.
3
8821
by: khoward | last post by:
Hi, I have an Access 2007 database that contains customer contact information. There are over 8,000 that include name, organization (as a look-up column), email, phone, address, and events that each person should be invited to (also a look-up column). Separate from this is an Excel spreadsheet that contains the some of the same information, with about 10,000 records. The overlap with duplicate names/records is probably about 50%, but of...
0
8403
marktang
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...
0
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8737
jinu1996
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...
0
8610
tracyyun
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...
1
6174
isladogs
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...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.