PC Review


Reply
Thread Tools Rate Thread

how to add a column to an existing record?

 
 
=?Utf-8?B?dGFtZXJlbHJlZmFpZQ==?=
Guest
Posts: n/a
 
      16th Jul 2007
I've made a union query and I want to add now a column to this query
Beside I want it to get the table name beside each record because these
records belongs to different tables as I said in the begining it's a union
query.

example
table1
table2
table3

union query xyz containing all data in these three tables.

I want to add a column to this query and in this column, i want it to
contain infront of each record the name of the table from which it come from.

please really need your help.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      16th Jul 2007
Add the following to each select statement in the union query ---
, "YourTableName" AS [TableName]
--
KARL DEWEY
Build a little - Test a little


"tamerelrefaie" wrote:

> I've made a union query and I want to add now a column to this query
> Beside I want it to get the table name beside each record because these
> records belongs to different tables as I said in the begining it's a union
> query.
>
> example
> table1
> table2
> table3
>
> union query xyz containing all data in these three tables.
>
> I want to add a column to this query and in this column, i want it to
> contain infront of each record the name of the table from which it come from.
>
> please really need your help.

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      16th Jul 2007
SELECT Field1, FIeld2, "Table1" As DataSource
FROM Table1
UNION
SELECT Field1, FIeld2, "Table2"
FROM Table2
UNION
SELECT Field1, FIeld2, "Table3"
FROM Table3

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tamerelrefaie" <(E-Mail Removed)> wrote in message
news:02E985AB-CCAC-4F2D-9538-(E-Mail Removed)...
> I've made a union query and I want to add now a column to this query
> Beside I want it to get the table name beside each record because these
> records belongs to different tables as I said in the begining it's a union
> query.
>
> example
> table1
> table2
> table3
>
> union query xyz containing all data in these three tables.
>
> I want to add a column to this query and in this column, i want it to
> contain infront of each record the name of the table from which it come
> from.
>
> please really need your help.



 
Reply With Quote
 
=?Utf-8?B?dGFtZXJlbHJlZmFpZQ==?=
Guest
Posts: n/a
 
      16th Jul 2007
Really thanks alot Karl

"KARL DEWEY" wrote:

> Add the following to each select statement in the union query ---
> , "YourTableName" AS [TableName]
> --
> KARL DEWEY
> Build a little - Test a little
>
>
> "tamerelrefaie" wrote:
>
> > I've made a union query and I want to add now a column to this query
> > Beside I want it to get the table name beside each record because these
> > records belongs to different tables as I said in the begining it's a union
> > query.
> >
> > example
> > table1
> > table2
> > table3
> >
> > union query xyz containing all data in these three tables.
> >
> > I want to add a column to this query and in this column, i want it to
> > contain infront of each record the name of the table from which it come from.
> >
> > please really need your help.

 
Reply With Quote
 
=?Utf-8?B?dGFtZXJlbHJlZmFpZQ==?=
Guest
Posts: n/a
 
      16th Jul 2007
Really thanks alot Douglas

"Douglas J. Steele" wrote:

> SELECT Field1, FIeld2, "Table1" As DataSource
> FROM Table1
> UNION
> SELECT Field1, FIeld2, "Table2"
> FROM Table2
> UNION
> SELECT Field1, FIeld2, "Table3"
> FROM Table3
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "tamerelrefaie" <(E-Mail Removed)> wrote in message
> news:02E985AB-CCAC-4F2D-9538-(E-Mail Removed)...
> > I've made a union query and I want to add now a column to this query
> > Beside I want it to get the table name beside each record because these
> > records belongs to different tables as I said in the begining it's a union
> > query.
> >
> > example
> > table1
> > table2
> > table3
> >
> > union query xyz containing all data in these three tables.
> >
> > I want to add a column to this query and in this column, i want it to
> > contain infront of each record the name of the table from which it come
> > from.
> >
> > please really need your help.

>
>
>

 
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
adding a new record at subform should update an existing record (not create new record) Mark Kubicki Microsoft Access Form Coding 1 16th Jan 2009 08:34 AM
Auto Populate new record form with an existing record's data =?Utf-8?B?SUx1dkFjY2Vzcw==?= Microsoft Access Reports 0 19th May 2006 05:04 PM
Importing to existing table but any existing record need to be upd =?Utf-8?B?ZGNvcmVudGlu?= Microsoft Access External Data 0 15th May 2006 11:32 AM
JS-Q9 Restricting available options on form, contrasting new record with editing existing record Jack Sheet Microsoft Access Getting Started 4 9th Nov 2005 12:38 PM
Any problems copying one existing record to another existing record? tmb Microsoft Access 2 17th Dec 2004 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:34 PM.