Using a field to determine column of another table

  • Thread starter Thread starter PF
  • Start date Start date
P

PF

Hi all,

I'm trying to use a field (TaxNa)in a table (T_Ins) to
determine wich of the columns (Tx1, Tx2, Tx3,..., Tx12) to
use in another table (T_Tx). I'm using the select column
to "feed" a combobox in a form based in the T_Ins table.
Then I want in a query to link these two tables, but using
for operations the field of the T_Tx table chosen in the
T_Ins table. I have tried several conections between these
two tables, but to no avail.

Anyone has a soultion, preferabily without code, as my
knowledge of that is very basic?

Thanks in advance.

PF
 
PF,

You are making this way more difficult than it needs to be! :-) I
suggest you take advantage of the benefits of a database, and re-design
your tables. It is almost certainly incorrect to have the fields Tx1 -
Tx12. The data that is in these fields should only be in one field. I
can't say much more specific at this stage, because I don't know much
about your data. But if you would care to post back with some details,
with examples, of what this is all about, someone will be able to advise
further.
 
Hello,

Are you suggesting that I should use a table like that:

TxDt TxNm TxVl (<- field names)
01-01-04 Tx1 5.08
02-01-04 Tx1 5.09
....
01-01-04 Tx2 4.12
02-01-04 Tx2 4.15
....

I use a UNION query to create this "table", but it is
extremely slow and sometimes crashes.

The main reason forr the introduction of the values like
I'm doing is because I download them monthly and they came
like that.

With best regards,

PF
 
PF,

If you are at the mercy of an un-normalised structure in imported data,
you have two choices. You can either retain the structure of the
imported data, and try to manipulate it to get the results you require.
Or you can manipulate the data into a more useable structure and then
do your processing from there. I would strongle recommend the second
approach, in almost all cases. In other words, the answer to your
question is Yes. I would set up the table as you have described it, as
the "working" table for the data. After your monthly download, I would
immediately run a simple series of Append Queries to move the data from
the tables the data is imported into, to this "working" table. This
way, if I understand you correctly, the type of problem you initially
asked about will disappear.
 
Back
Top