473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

[Field name] returned as data in query results

Can I get field names to be returned as data in a query's results?
E.g. I have 3 fields (City, Town, Village), and want the results to
incorporate these as data, e.g.:

City 2
Town 4
Village 5
Town 3
City 9

Hope this makes sense - any ideas?

Thanks!
Martin Lacoste
Nov 13 '05 #1
4 1782
Use a crosstab query. When you design a new query select Cross Tab query
wizard and it will walk you through.

--
Reggie

----------
"Martin Lacoste" <ma*******@rogers.com> wrote in message
news:d4**************************@posting.google.c om...
Can I get field names to be returned as data in a query's results?
E.g. I have 3 fields (City, Town, Village), and want the results to
incorporate these as data, e.g.:

City 2
Town 4
Village 5
Town 3
City 9

Hope this makes sense - any ideas?

Thanks!
Martin Lacoste

Nov 13 '05 #2
ma*******@rogers.com (Martin Lacoste) wrote in
news:d4**************************@posting.google.c om:
Can I get field names to be returned as data in a query's
results? E.g. I have 3 fields (City, Town, Village), and want
the results to incorporate these as data, e.g.:

City 2
Town 4
Village 5
Town 3
City 9

Hope this makes sense - any ideas?

Thanks!
Martin Lacoste


your three fields need to be two fields, one for the municipality
type, the second for your number.

That way, when the government decides to merge all the towns into
one megacity, you do not have to alter your table, queries, forms
reports and macros in order to capture the changing reality by
adding a field. You just add the new definition to the list of
municipality types.

Bob Quintal

Nov 13 '05 #3
Bob Quintal <bq******@generation.net> wrote in message news:<c9******************************@news.terane ws.com>...
ma*******@rogers.com (Martin Lacoste) wrote in
news:d4**************************@posting.google.c om:
Can I get field names to be returned as data in a query's
results? E.g. I have 3 fields (City, Town, Village), and want
the results to incorporate these as data, e.g.:

City 2
Town 4
Village 5
Town 3
City 9

Hope this makes sense - any ideas?

Thanks!
Martin Lacoste


your three fields need to be two fields, one for the municipality
type, the second for your number.

That way, when the government decides to merge all the towns into
one megacity, you do not have to alter your table, queries, forms
reports and macros in order to capture the changing reality by
adding a field. You just add the new definition to the list of
municipality types.

Bob Quintal

Thanks for the reply, Bob - I over-simplified the example to minimize
confusion (my own, likely). What I have is an existing table, with
11000+ records, and more than 80 fields that are similar in the type
of data they contain. This is looney, I know, and there is
undoubtedly a better way to design it, but, alas, here we are. Each
record is a musical chant that appears in any number of manuscripts
(many occur in one only, but some do appear in 20 or 30 or more). If
you have any grand ideas as to the table's design, I'm all ears.

Failing that, I think if I can get the data into a second table (or
query), I can get the job done. Here's an example:

ID MS1 MS2 MS3 MS4.....to MS80+
1 a
2 b
3 a c
4 d

If I can construct a query that will
generate the following results (from data above)...:

ID MS
1 a
2 b
3 a
3 c
4 d

.... then I should be able to do what I need. Now (please
excuse my access-newbieness) I'm trying to figure out how
to do this - I'm sure this should be easy, and I've
probably even done it in the past, and yet, well,... here I
am asking you experts.

Hope this helps to clarify - and many thanks for your time!
Martin Lacoste
Nov 13 '05 #4
ma*******@rogers.com (Martin Lacoste) wrote in message news:<d4**************************@posting.google. com>...
Bob Quintal <bq******@generation.net> wrote in message news:<c9******************************@news.terane ws.com>...
ma*******@rogers.com (Martin Lacoste) wrote in
news:d4**************************@posting.google.c om:
Can I get field names to be returned as data in a query's
results? E.g. I have 3 fields (City, Town, Village), and want
the results to incorporate these as data, e.g.:

City 2
Town 4
Village 5
Town 3
City 9

Hope this makes sense - any ideas?

Thanks!
Martin Lacoste


your three fields need to be two fields, one for the municipality
type, the second for your number.

That way, when the government decides to merge all the towns into
one megacity, you do not have to alter your table, queries, forms
reports and macros in order to capture the changing reality by
adding a field. You just add the new definition to the list of
municipality types.

Bob Quintal

Thanks for the reply, Bob - I over-simplified the example to minimize
confusion (my own, likely). What I have is an existing table, with
11000+ records, and more than 80 fields that are similar in the type
of data they contain. This is looney, I know, and there is
undoubtedly a better way to design it, but, alas, here we are. Each
record is a musical chant that appears in any number of manuscripts
(many occur in one only, but some do appear in 20 or 30 or more). If
you have any grand ideas as to the table's design, I'm all ears.

Failing that, I think if I can get the data into a second table (or
query), I can get the job done. Here's an example:

ID MS1 MS2 MS3 MS4.....to MS80+
1 a
2 b
3 a c
4 d

If I can construct a query that will
generate the following results (from data above)...:

ID MS
1 a
2 b
3 a
3 c
4 d

... then I should be able to do what I need. Now (please
excuse my access-newbieness) I'm trying to figure out how
to do this - I'm sure this should be easy, and I've
probably even done it in the past, and yet, well,... here I
am asking you experts.

Hope this helps to clarify - and many thanks for your time!
Martin Lacoste


One way of fixing this is to create a final table with the (ID,MS)
fields. Then you could loop through all the records
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
8
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: ...
0
by: CSDunn | last post by:
Hello, I have a format issue on an Access 2000 ADP report that I am going to attempt to explain from a 'ten thousand foot view' : I have an Access 2000 ADP report that has a SQL Server 2000...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
5
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
1
by: Adam Sandler | last post by:
Hello, I'm reusing a method here which sends a query to the database and returns the results formatted as XML. In the codebehind, I call the method we reuse here (and have successfully many...
2
by: Brave | last post by:
I'm hoping someone can help me with a small issue. I have an asp page that displays informaton from an Access database. I want to create a form that allows users to display only data that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.