View Single Post
  #3  
Old February 21st, 2006, 09:46 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default create field from two fields

A better approach is to keep the data fields seperate and use a 'combined
key' for the Primary key of the new table.

New Table:
[propertyID]
[TenantID]
[field1]
[field2]
etc.

PK ([PropertyID],[TenantID] ) You can set this combined key by highlighting
both fields in table design and selecing the "key".

Now you can set up your relationships to PropertyTable [PropertyID] --
NewTable [PropertyID],[TenantID] ---[TenantID] TenantTable

Each property can have 0 to Many tenants and each tenant can be related to 0
to many properties.

Even better you can ask queries like "list all the tenant addresses for each
property".

If you really must 'combine' the fields then we must assume you want to
consider them 'text' fields:

e.g.
Propertyid
1
2
3
4

TenantID
1
2
3
4

should become:
1,1
2,1
3,4
And Not
2
3
7
So you use the "&" operator
[PropertyID] & "," & [TenantID]

Ed Warren

"mackdiva" wrote in message
...
I have a property table and a tenant table. I would like to create a new
field
{propertyID} + {TenantID}. One property might have several tenants or
none
at all. Also this field needs to be a primary key for new table