creating a table using VB

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

Guest

Hello,
is there a way to create a table using vb?
essentially, I want some specific table called tempT to be the rowSource of
a chart. but every time I open the chart I want to erase the table tempT and
re-create it differently using vb, so I actually want to erase an existing
table (or erase all its fields) and then re-define its properties. Is there a
way doing that?
thank you
 
You write a CREATE TABLE SQL statement and issue it in VB just as you would
any other SQL statement.

Don't forget: SQL is divided into Data Definition and Data Manipulation sets
of commands. But to VB, it's all the same.
 
Thanks.
I tried it and it works. the only problem is that every time I get to that
specific line in the code, I get a message that the table already exists and
therefor will be erased before it is re-created, and I need to confirm.
Is there a way erasing it manually to avoid the message?
thanks
 
Is there a way erasing it manually to avoid the message?

db.execute "DROP TABLE MyTable", dbFailOnError


Remember to DROP any constraints (e.g. relationships) that involve it
first.

Hope that helps


Tim F
 
Is it really necessary that you delete the table from the database every
time? Is the structure always the same? If yes, you could delete the
existing records instead of the entire table...and then append the new
records.
 
Yes it is. The structure and the data verifies...
I found that using the following line works:
DoCmd.deleteObject acTable, "TableName"

Thanks for all the help
 
Back
Top