PC Review


Reply
Thread Tools Rate Thread

How to create a new field from other record fields in a table

 
 
FSHOTT
Guest
Posts: n/a
 
      29th Oct 2008
Can someone show me how to create a field in a table or query which is made
up of other fields in the in the current and previous records? That is say I
have field TypeID in a Table and I would like to add a new field DeltaTypeID
which compares (=) TypeID from record x to TypeID from record x-1.
--
frank-a
 
Reply With Quote
 
 
 
 
KARL DEWEY
Guest
Posts: n/a
 
      29th Oct 2008
You did not say much about your table structure.
The trick is being able to select the previous record.
Your query you put the table twice and Access adds a sufix of '_1' on the
name of the second instance of the table. You have to use information from
one and compare with the other such as autonumber minus one. You can also
work with dates by selecting the first date lower or higher than the other
table record.
--
KARL DEWEY
Build a little - Test a little


"FSHOTT" wrote:

> Can someone show me how to create a field in a table or query which is made
> up of other fields in the in the current and previous records? That is say I
> have field TypeID in a Table and I would like to add a new field DeltaTypeID
> which compares (=) TypeID from record x to TypeID from record x-1.
> --
> frank-a

 
Reply With Quote
 
NTC
Guest
Posts: n/a
 
      29th Oct 2008
SELECT TableName.KeyField, TableName.TypeID, (TableName.TypeID-T2.TypeID) AS
DeltaTypeID
FROM TableName LEFT JOIN TableName AS T2 ON TableName.KeyField-1=T2.KeyField;



"FSHOTT" wrote:

> Can someone show me how to create a field in a table or query which is made
> up of other fields in the in the current and previous records? That is say I
> have field TypeID in a Table and I would like to add a new field DeltaTypeID
> which compares (=) TypeID from record x to TypeID from record x-1.
> --
> frank-a

 
Reply With Quote
 
FSHOTT
Guest
Posts: n/a
 
      3rd Nov 2008
What is the TableName.TypeID-T2 ? And what does the
(TableName.TypeID-T2.TypeID ) do in the SELECT statement?
--
frank-a


"FSHOTT" wrote:

> Can someone show me how to create a field in a table or query which is made
> up of other fields in the in the current and previous records? That is say I
> have field TypeID in a Table and I would like to add a new field DeltaTypeID
> which compares (=) TypeID from record x to TypeID from record x-1.
> --
> frank-a

 
Reply With Quote
 
NTC
Guest
Posts: n/a
 
      3rd Nov 2008
replace TableName with your actual table name

T2 is literal - it needs to be there as the alias of the duplicate table

It is not: TableName.TypeID-T2

It is math: TableName.TypeID-T2.TypeID

This is the delta calculation of the TypeID field


"FSHOTT" wrote:

> What is the TableName.TypeID-T2 ? And what does the
> (TableName.TypeID-T2.TypeID ) do in the SELECT statement?
> --
> frank-a
>
>
> "FSHOTT" wrote:
>
> > Can someone show me how to create a field in a table or query which is made
> > up of other fields in the in the current and previous records? That is say I
> > have field TypeID in a Table and I would like to add a new field DeltaTypeID
> > which compares (=) TypeID from record x to TypeID from record x-1.
> > --
> > frank-a

 
Reply With Quote
 
FSHOTT
Guest
Posts: n/a
 
      3rd Nov 2008
Yes That worked - Great Thank You very much.....
--
frank-a


"NTC" wrote:

> replace TableName with your actual table name
>
> T2 is literal - it needs to be there as the alias of the duplicate table
>
> It is not: TableName.TypeID-T2
>
> It is math: TableName.TypeID-T2.TypeID
>
> This is the delta calculation of the TypeID field
>
>
> "FSHOTT" wrote:
>
> > What is the TableName.TypeID-T2 ? And what does the
> > (TableName.TypeID-T2.TypeID ) do in the SELECT statement?
> > --
> > frank-a
> >
> >
> > "FSHOTT" wrote:
> >
> > > Can someone show me how to create a field in a table or query which is made
> > > up of other fields in the in the current and previous records? That is say I
> > > have field TypeID in a Table and I would like to add a new field DeltaTypeID
> > > which compares (=) TypeID from record x to TypeID from record x-1.
> > > --
> > > frank-a

 
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
Create Query to display three fields for every record in a table. AJRoad Microsoft Access Queries 4 26th Apr 2008 11:15 PM
combine two fields in form to create one field in table =?Utf-8?B?S2lt?= Microsoft Access Forms 20 27th Aug 2007 06:38 PM
Re: concatenate table fields to create a single table field pietlinden@hotmail.com Microsoft Access Database Table Design 0 17th Jan 2007 08:08 PM
How2 move 1 field from 97 recrds to create 1 table with 97 fields =?Utf-8?B?RnVuSW5Qcm9ncmFtbWluZw==?= Microsoft Access Macros 5 6th Feb 2006 01:58 AM
Must I create a record for each value in a field in this table? John Microsoft Access Queries 5 15th Nov 2005 05:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:07 AM.