Creating a table with VB

Nittylions

Registered User.
Local time
Today, 13:30
Joined
May 9, 2006
Messages
15
Here is what i want to do. I currently have a query created that will make a table. What I want to do is use that query and create a table daily without losing the prior table. For example I run the query to I would like to create a table entitled "Research_070708" then i want to run the same query again tomorrow and create a table called "Rsearch_070808". Currently I go into the query design view and click the make table icon and key in the new table to be created. I would love it so i do not have to do this. Thanks for the help in advance.
 
you'll have to use code...run a function on an Auto_Exec macro. That should work fine. The first thing I can think of, especially if you're going to identify your new tables with some sort of date recognition figure, is to verify that the table has not already been created. Maybe do it like this
Code:
dim tbl as tabledef

  for each tbl in currentdb.tabledefs
    if right(some length of the name here) = date then
      DO NOTHING
    else
      MAKE THE TABLE "code" here
    end if
  next tbl
Obviously that's just a sample, but it should get you started.

Look up "tabledef" and "field" object for VB in the help menu too...
 

Users who are viewing this thread

Back
Top Bottom