Creating New MS Access Database From AutoCAD

Creating New MS Access Database From AutoCAD

Anonymous
Not applicable
337 Views
6 Replies
Message 1 of 7

Creating New MS Access Database From AutoCAD

Anonymous
Not applicable
I am an experiencd user of AutoCAD and Access and have linked information between the two systems into existing databases. I cannot get any information as to how to create a new database. I have vague pieces of info like 'CreateDatabase' & 'CreateTable' and although I can use these without error nothing actually happens. So...
1. Can you tell me how to create a new database with tables from AutoCAD &
2. Is there anywhere I can go on the web to get this info about VBA functions of various packages - it is not in any help file, book or web site that I know of

Thanks
Kesta
0 Likes
338 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
I have successfully created an Access database using the DAO 3.51 Object library (CreateDatabase, CreateTableDef, CreateField methods) through Excel VBA (Acad is the same) without any glithces, can't remember where I put the code though. You may also be able to the same with ADO (ActiveX Data Objects) which seems the more popular choice for Database access. Try searching the Microsoft MSDN VB documentation, this is where I figured out how to do it.
0 Likes
Message 3 of 7

Anonymous
Not applicable
Kesta:

 

See the zip in customer files under the subject
"Create Data Base DAO", it contains a vb 6 project for database creation using
dao.

The next links use to have very good ingormation on
vb and others topics

 




 

-gnb


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">

 

0 Likes
Message 4 of 7

Anonymous
Not applicable
Please, let DAO & RDO die gracefully... MS is killing them anyway,
so don't prolong their lives because of supposed 'performance issues' with
ADO. The only performance issue with ADO i've seen since 2.1 (and it was a
performance killer) is programmers inability to upgrade their
skills. Use ADO instead... But this code doesn't depend on any of them
(ADO, DAO, or RDO)

 

    'early binding

    Dim accessApp As New
Access.Application
    accessApp.CreateAccessProject
("path\to\myDb.mdb")
0 Likes
Message 5 of 7

Anonymous
Not applicable
Yeah, it only depends on Office being installed on
that computer... Let the programmer beware. ADO gives your code Office
independence.


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Please, let DAO & RDO die gracefully... MS is killing them
anyway, so don't prolong their lives because of supposed 'performance issues'
with ADO. The only performance issue with ADO i've seen since 2.1 (and it
was a performance killer) is programmers inability to upgrade their
skills. Use ADO instead... But this code doesn't depend on any of them
(ADO, DAO, or RDO)

 

    'early binding

    Dim accessApp As New
Access.Application
    accessApp.CreateAccessProject
("path\to\myDb.mdb")
0 Likes
Message 6 of 7

Anonymous
Not applicable
It seems Kesta is not interested,
anyway:

 

Dim adoCat As New ADOX.Catalog ' Needs an ADO
Extension  reference
Dim adoConn As New ADODB.Connection 'Needs an ADO
lib reference
Dim cnStr As String
Dim sql As String
adoCat.Create
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\dbTest.mdb;"
cnStr =
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data
Source=C:\dbTest.mdb;Persist Security Info=False"
Set adoCat =
Nothing
adoConn.Open cnStr
sql = "CREATE TABLE CONTACTS ([CNAME]
TEXT,[CADDRESS]TEXT)"
adoConn.Execute sql
adoConn.Close
Set adoConn =
Nothing
0 Likes
Message 7 of 7

Anonymous
Not applicable
Note: MDAC 2.6 and 2.7 do not contain any of the
JET components. 

 


href="http://support.microsoft.com/support/kb/articles/Q271/9/08.ASP">Q271908
 [http://support.microsoft.com/support/kb/articles/Q271/9/08.ASP]
and 


href="http://support.microsoft.com/support/kb/articles/Q239/1/14.ASP">Q239114
 [http://support.microsoft.com/support/kb/articles/Q239/1/14.ASP]

 

 
0 Likes