Howto move a query into a temp table that would be named by user

J

JLPerez

This is the scenario:
1. User run a sql query from a form where they select different fields
and/or criterias. This portion is working great.
2. The query result is called "Dynamic_Query". The user might need to save
this query for further updates or review. From a viewing form of this query,
I have a button where they could save the results into a table with whatever
name they want. (Not sure how to do that..)

3. That new table should be retrievable and users should be able to
update/print reports, etc. I would like to create like a list of those tables.

4. User can Modify any of the fields and ADD new information Once the user
gets the reports printed, that table should UPDATE the fields of the mainDB
where the result-query was done. After the update, the temp table should be
deleted from the system.

My thoughts are to create a "dump" table with forms and reports with the
same structure than the query-results and the mainDB and rename that table
with whatever name they choose.
Any input in the best way to implement this would be greatly appreciated.

Thanks
 
L

Lance

There are a couple potential problems with this approach.

If you're putting this data in a new table, any changes made to it or your
master data will not be reflected in the opposite table. If there aren't
going to be any changes made, then there's no reason to make a seperate table
in the first place.

In either case, you'd be better served by simply storing a SQL string and
running that query again on demand.

If you really do need to create seperate tables, that can be accomplished by
changing the "INTO" value of your SQL statement.

SQL_STRING = "SELECT SOME_TABLE.WHATEVER INTO " & target_table_name & " FROM
SOME_TABLE"
docmd.runsql(SQL_STRING)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top