Use Query or Macro to Creat enew Database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to figure out a way to create a new database from within an existing
database during a process in which i am running several queries. the new
database name will have a generic name like "Quarterly..." but will then be
concatenated with the quarterly submittal date in a specific format (e.g.,
20070601)

I'm thinking i could create a query to determine the quarterly date and then
concatenate with the other part of the file name, but how would i actually
create a process for creating a new database (in a specified directory) from
within my existing directory. any suggestions? thanks. Ruben
 
I need to figure out a way to create a new database from within an existing
database during a process in which i am running several queries. the new
database name will have a generic name like "Quarterly..." but will then be
concatenated with the quarterly submittal date in a specific format (e.g.,
20070601)

I'm thinking i could create a query to determine the quarterly date and then
concatenate with the other part of the file name, but how would i actually
create a process for creating a new database (in a specified directory) from
within my existing directory. any suggestions? thanks. Ruben

Do you want a new *DATABASE* - a new .mdb file container for multiple tables,
forms, reports, code, etc.?

Or do you want a new *TABLE* of records?

Or do you really want to extract a subset of the data in a table (for a
particular quarter, say) and use it to generate printed reports, view it using
forms, etc.?

If the latter - as I suspect - you should almost certainly simply use a Query
selecting that quarter's data as the recordsource for reports and forms. It is
*very bad design* to store data (a date range, implicitly) in a tablename or -
even worse - a database name.

You *can* use the VBA CreateDatabase method to do this, followed by multiple
TransferDatabase actions to copy various tables and other objects into the new
database; but then you would have the same data stored redundantly in two
different databases, running a major risk that corrections made to one
instance of the data would not be reflected in the other.

John W. Vinson [MVP]
 
Back
Top