Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD and MS Access Database

Status
Not open for further replies.

Kckronic21

Programmer
Jul 29, 2001
81
US
Hi, I was wondering if there was anyway to connect a MS Access database to AutoCAD? Thanks!
 
You can use VBA to read/write Access databases

Here is an example of reading a table

Dim wrkJet As Workspace
Dim dbsDrawing As Database
Dim strDatabase As String
Dim strQuery As String
Dim rstTemp As Recordset

strDatabase = "test.mdb"
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
MsgBox "Opening Database (" & strDatabase & ")"
Set dbsDrawing = wrkJet.OpenDatabase(strDatabase, True)

strQuery = "SELECT * FROM table ORDER BY counter;"
MsgBox "Running Query..."
Set rstTemp = dbsDrawing.OpenRecordset(strQuery, _
dbOpenDynaset, dbReadOnly)
With rstTemp
Do While Not .EOF
Debug.Print , .Fields(0), .Fields(1)
.MoveNext
Loop
End With
dbsDrawing.Close
wrkJet.Close

Nick
nick.hall@altasystems.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top