Create table in blank databse

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

I have created a blank database in Access 2003.
Now I want to create tables using scripts from queries, is it possible?
And how if it is possible?
 
Why the extra effort? Just use the wizard or design view to create the table.
 
Run the SQL statement:


databaseObject.Execute "CREATE TABLE tableName (f1 AUTOINCREMENT
PRIMARY KEY, f2 LONG NOT NULL , f3 TEXT(50) , ... )"



(in VBA or using the Debug Immediate Window). Note that Jet Data-type are
not necessary the same as for MS SQL Server. Text, in Jet, is a varchar, in
MS SQL Server, and text, in MS SQL SERVER is a memo, in Jet.



Hoping it may help,
Vanderghast, Access MVP
 
The query would be created in the database referred by the
"databaseObject", as long as you have the rights to do it, through the said
object. If you use CurrentDb, the actual db will be used. If you use CodeDb,
the db having the code will be used. Etc.


Hoping it may help,
Vanderghast, Access MVP
 

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

Back
Top