Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I fuse 2 fields from a table to only one in a query? 2

Status
Not open for further replies.

JMPUK

Technical User
Feb 14, 2004
15
GB
I would like to be able to show the data of two fields from a table (combined them) into one one field from a query?
How can I do that? Is this possible?

Thank you for getting back to me....
 
In the query, concationate them, perhaps also put in some separators:

[tt]NewField: OneField & " " & NotherField[/tt]

Could also concatinate in e textbox controlsource.

Roy-Vidar
 
Thank you Roy-Vidar, I'll try this and let you know...
 
Roy-Vidar,
I have tried this and it will give me the data as below:
Definition:
dataA = data from Table A
dataB = data from Table B

Result:
dataA1 dataB1
dataA2 dataB2
dataA3 dataB3
dataA4 dataB4
dataA5 dataB5
dataA6 dataB6
(etc)

What I am seeking is:
dataA1
dataB1
dataA2
dataB2
dataA3
dataB3
dataA4
dataB4
dataA5
dataB5
dataA6
dataB6
(etc)

Could someone help? Thanks in advance...
 
So you are not trying to combine/concatinate two fields.

I don't understand what you're after. What would the result of 1 row look like?

Is this a formatting thingie only, is this supposed to be working in a report, you could simply put the textcontrols below eachother in the detail section, or use a concatination using for instance something like this in the textbox controlsource:

[tt]=OneField & chr(13) & chr(10) & NotherField[/tt]

Roy-Vidar
 
Roy-Vidar,
Thank you for getting back to me on this one...
Unfortunately, this doesn't work either...

Let say that in a table you have 2 fields, one is fruit and the other is vegetable as below:

FRUIT
apple
pear
orange
pinaple
(etc)

VEGETABLE
potatoe
peas
beans
carrrots
(etc)


From this two fields, I would like to create a query to be able to see only one fields which would combined these two fields as below:

FRUIT & VEGETABLE
apple
beans
carrrots
pear
orange
peas
pinaple
potatoe
(etc)

Is this possible?
Hey hey, let me know :) Thanks...
 
You talk about having two fields in the same table, but you illustrate it as if it where one field in two different tables - so I'm just getting more and more confuese (that is - even more than usual;-))

Illustration of two fields in the same table might look more like this:
[tt]
FRUIT VEGETABLE
apple peas
pear potatoe
orange beans
pinaple carrots
(etc) (etc)[/tt]


Here's a little sample using a "union self query" that might (or might not) be something in the direction you need (bringing both the primary key field and the vegetable/fruit thingie).

[tt]Select tbl1.PK, tbl1.Vegetable From tbl1
UNION
Select tbl1.PK, tbl1.Fruit From tbl1
ORDER BY Vegetable[/tt]

Should you be using two tables, a union query might still be used, just work on the table names.

Roy-Vidar
 
That is the answer I was looking for....
Nice one....

Thanks a million :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top