Merge fields in query

Curry

Registered User.
Local time
Tomorrow, 03:16
Joined
Jul 21, 2003
Messages
73
Hi All,

I have a query which outputs a number of fields.

SELECT qryTypeofProject_Report.*
FROM qryTypeofProject_Report;

I have used SELECT qryTypeofProject_Report.* in order to get all the fields from the initial query its based on. I want a final field that merges all the previous fields for a record into one. I know I can do this via [Field 1] & [Field 2] & [field 3] etc...however in this case I do not necessarily know the names or the number of fields required. Is there a way to produce a merged field in this query based on the SELECT qryTypeofProject_Report.* command?

Thanks All
 
It would be more efficient to do your merging on the form. Just let the query do the gathering of data. To concatenate you do this.

Let's say [Field1] contains "Joe" and [Field2] contains "Bloggs", if you concatenate using ampersand (&) you do this;
Code:
[Field1] & [Field2]
And the result is "JoeBloggs"

So if you want spaces you do this:
[Field1] & " " & [Field2]
 
there is no way to do this easily. you'll need code. you can't do it with general SQL. if it has to be dynamic, code will be necessity. more than likely, you will have to use recordset objects to loop the fields and read the record.
 
I thought as much. I was hoping for something simpler.

Thanks for your response.

Ian
 

Users who are viewing this thread

Back
Top Bottom