A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

create field from two fields



 
 
Thread Tools Display Modes
  #1  
Old February 20th, 2006, 10:28 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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  
Old February 20th, 2006, 11:16 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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  
Old February 21st, 2006, 10: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



  #4  
Old February 24th, 2006, 07:51 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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 06: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 05:11 AM
Access 2000, autonumber fields Zyberg74 General Discussion 3 November 17th, 2004 05:24 PM


All times are GMT +1. The time now is 07:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.