Re: Variabel fieldnames in queries

From: Marshall Barton <marshbarton_at_Mindspring.com>
Date: Sat, 21 Jul 2001 23:33:21 GMT
Message-ID: <9hvjef$l3l$1_at_slb3.atl.mindspring.net>


Remco,

You can't use an expression in place of the name of a field in SQL.

The problem you're trying to solve is caused by your table structure - it looks more like a spreadsheet than a relational database table. You should have a separate table that has at least three fields: the Foreign Key of the item being measured, a measurement ID and the value. This way, your query would be searching for the measurement values where the Measurement ID is the desired [period].

Marsh

R. Groot Beumer wrote in message ...
>Hello (again),
>
>I have a question about the use of variabel fieldnames in
 queries. In a
>table of mine I've worked with cummulatives. The tables has
 got (among
>others) 13 fields which are named: cm_01, cm_01, cm02 etc
 (last one is
>cm_13).
>In a certain query I want to get the values of one of the
 above fields by
>using a variabel (perhaps a function). So the user is
 asked: "Which period
>do you want to export". The system must take the right
 field. In simple VBA
>this is done with: Me("cm_" & [period]) but how is this
 done within a
>query.
>
>As usual: any help is appreciated !!
>
>Thanx,
>
>Remco (Holland)
>
>
Received on Sun Jul 22 2001 - 01:33:21 CEST

Original text of this message