Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Is this possible? WHERE [ColumnValue]=[TableName]

menelaosmenelaos Member Posts: 45
Here is what i am trying to do with a coupld of mdbs in access.


Supposing we have a database called SPEC and it had 50 tables.
Each and every one of those tables has a column called "diameter1"

Now, we have a second database called PRJ.
One of its tables is called "Components"
And in this table we have a field called "SpecName"

In PRJ, we create a report and one of its fields needs to read data from the "diameter1" column but it can vary as to which table of SPEC it will be read from.

so, question is

is it possible to choose the table we read from by doing and clause such as WHERE SpecName = tablename?

I remind that SpecName is in a table in PRJ and "tablename" is the name of the table to be used from the SPEC database.

Whoever can help, i will greatly appreciate it.

Thank you in advance.

Menelaos Prokos
Software Engineer

Comments

  • dokken2dokken2 Member Posts: 532
    : Here is what i am trying to do with a coupld of mdbs in access.
    :
    :
    : Supposing we have a database called SPEC and it had 50 tables.
    : Each and every one of those tables has a column called "diameter1"
    :
    : Now, we have a second database called PRJ.
    : One of its tables is called "Components"
    : And in this table we have a field called "SpecName"
    :
    : In PRJ, we create a report and one of its fields needs to read data from the "diameter1" column but it can vary as to which table of SPEC it will be read from.
    :
    : so, question is
    :
    : is it possible to choose the table we read from by doing and clause such as WHERE SpecName = tablename?
    :
    : I remind that SpecName is in a table in PRJ and "tablename" is the name of the table to be used from the SPEC database.
    :
    : Whoever can help, i will greatly appreciate it.
    :
    : Thank you in advance.
    :
    : Menelaos Prokos
    : Software Engineer
    :
    :

    Not the WHERE clause, change the Sql FROM-

    for different tables in same db:

    SELECT diameter1 FROM Table1;
    SELECT diameter1 FROM Table2;

    for tables in an external db, use the IN statement:

    SELECT diameter1 FROM Table1 IN "C:PathMyDB.mdb";
    SELECT diameter1 FROM Table3 IN "C:PathMyDB.mdb";


Sign In or Register to comment.