Parameter query

  • Thread starter Thread starter Eric Durán
  • Start date Start date
E

Eric Durán

Hi,

I want to create a parameter query, but instead of having the parameters
in the WHERE clause (Access' help only gives this kind of examples) I'd like
to use the parameters in the FROM clause.
The reason for this, it's just because I have a set of tables (Table1,
Table2, Table3) all having the same schema. Each table is the result of an
import operation (that's why they have the same schema) and I have a query
that I'd like to apply to each one of them.
So, instead of having to copy/paste the query each time I import a
table, I'd like to run my pre-defined query and just give the name of the
new table.

Is there a way to achieve this?

Thanks.
 
Eric,

As a alternate use query1, query2, query3 instead of table names and in
query use 'Select * from table1' .
You need not to chnage the main query for every time. just change the
query(s) when u get new tables. I use this technique when i had the same
problem.

The other alternate is use VBA code to build SQL statements.



Thanks
SAM
 
Hi,

I want to create a parameter query, but instead of having the parameters
in the WHERE clause (Access' help only gives this kind of examples) I'd like
to use the parameters in the FROM clause.
The reason for this, it's just because I have a set of tables (Table1,
Table2, Table3) all having the same schema.

In that case you have an incorrectly normalized database.
Each table is the result of an
import operation (that's why they have the same schema) and I have a query
that I'd like to apply to each one of them.
So, instead of having to copy/paste the query each time I import a
table, I'd like to run my pre-defined query and just give the name of the
new table.

Is there a way to achieve this?

Only by constructing the SQL string in code. You can't use a parameter
as a table name.

I'd suggest *appending* the imports to a master table, including a
field indicating which datasource you're appending, and query this
table, using a parameter on the added field.
 
That's right, Mr. Vinson. It is indeed a very un-normalized database.
But I didn't design it, and (more important) I won't nor can't change it.
So, I figured out that *appending* the imports to a master table would be
the way to go.

Thank you for the hint, Mr. Vinson
 
Back
Top