If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
create field from two fields
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 |
#2
|
|||
|
|||
create field from two fields
Create a new field where? Are the fields text or numeric?
Do you have a good reason for combining two values into a single value? This isn't normally good practice. Do you know how to create a make table query? Do you know how to concatenate expressions together using syntax like: [LastName] & ", " & [FirstName] -- Duane Hookom MS Access MVP -- "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 |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
create field from two fields
Thanks
This is working! "Ed Warren" wrote: 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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert source texts into multiple files and update automatically | robfer | General Discussion | 9 | September 12th, 2007 10:10 PM |
Is there a maximum size of field caption property in a table? | WTL | Database Design | 3 | November 13th, 2005 05:02 AM |
Multiple Options Group | Patty Stoddard | Using Forms | 19 | August 4th, 2005 02:30 PM |
Design help, please | SillySally | Using Forms | 27 | March 6th, 2005 04:11 AM |
Access 2000, autonumber fields | Zyberg74 | General Discussion | 3 | November 17th, 2004 04:24 PM |