PC Review


Reply
Thread Tools Rate Thread

Add Fields from Record

 
 
Scott
Guest
Posts: n/a
 
      5th May 2010
I have two tables. One has a unique PersonID with a lot of information about
the person (one to one). Another table has one to many records with
addresses associated with people. The 2nd table has an addressID and the
same person can have several address. Each address has an address type. As
it turns out, there is only one address type for each person, which helps me
in what I want to do.

I want to create a table that has a unique PersonID and a field in each
record for two of the types of addresses. In other words, one person has
what we call a HOR address and the same person has a Proposed HOR address. I
want to create a query/table that has the person's ID, a HOR field and a
Proposed HOR field. I want the table to be static, in the sense that I won't
be able to manipulate the records using VB to create a table each time the
query is run, because the query/table will be used to populate a Word
document that gets data from the table.

Ideas? Thanks.
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      5th May 2010
3 query solution.

Build two queries that return the addresses. One for each type.

SELECT *
FROM AddressTable
WHERE AddressType = "HOR"

SELECT *
FROM AddressTable
WHERE AddressType = "Proposed HOR"

In a third query link those two queries to the Person table using an outer join.

SELECT <Person Stuff Fields>
, <HOR Address fields>
, <Proposed HOR Address fields>
FROM (PersonTable LEFT JOIN queryHORAddresses
ON PersonTable.PersonID = queryHORAddresses.PersonID)
LEFT JOIN queryProposedHORAddresses
ON PersonTable.PersonID = queryProposedHORAddresses.PersonID

Don't create a table to use this data. You should be able to use the
information directly from the query.

If you don't know HOW to use the SQL view to create queries and cannot figure
out the process to make the queries in design view, post back. I will try to
give you some step by step on doing all this in query design view.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Scott wrote:
> I have two tables. One has a unique PersonID with a lot of information about
> the person (one to one). Another table has one to many records with
> addresses associated with people. The 2nd table has an addressID and the
> same person can have several address. Each address has an address type. As
> it turns out, there is only one address type for each person, which helps me
> in what I want to do.
>
> I want to create a table that has a unique PersonID and a field in each
> record for two of the types of addresses. In other words, one person has
> what we call a HOR address and the same person has a Proposed HOR address. I
> want to create a query/table that has the person's ID, a HOR field and a
> Proposed HOR field. I want the table to be static, in the sense that I won't
> be able to manipulate the records using VB to create a table each time the
> query is run, because the query/table will be used to populate a Word
> document that gets data from the table.
>
> Ideas? Thanks.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Filling Fields in Current Record from Previous Record J. Trucking Microsoft Access 2 15th May 2007 02:13 PM
A) 140 fields in a record -- OK ?? --- B) Do empty fields use disk space? MyEmailList@gmail.com Microsoft Access 6 16th Apr 2007 04:54 PM
update multiple fields in a record based on a record in another table bertil.hedenstrom@gmail.com Microsoft Access Queries 3 19th Sep 2006 11:49 AM
Get current record in subform and fill fields of that record to another form khanhly246 via AccessMonster.com Microsoft Access Form Coding 1 23rd Aug 2006 01:01 AM
For input of new record prompt user with previous record's fields Sam Stark Microsoft Access Form Coding 0 23rd Apr 2004 08:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:43 PM.