How to connect to DAO through visual lisp

How to connect to DAO through visual lisp

ivanstarr3
Contributor Contributor
1,080 Views
5 Replies
Message 1 of 6

How to connect to DAO through visual lisp

ivanstarr3
Contributor
Contributor

Hello all, I'm back after a long time away...

 

I did search under the provided mechanism and on the web in gnereal for this, you would think it would be more in demand, but I found nothing.

 

I'm simply trying to get access to the regular, original MS database access object library DAO, that's inside every copy of MS Access, in my case it's in a .dll called 

 

C:\\Program Files\\Common Files\\microsoft shared\\OFFICE16\\ACEDAO.DLL.

 

Now, when I 

(vlax-import-type-library :tlb-filename "C:\\Program Files\\Common Files\\microsoft shared\\OFFICE16\\ACEDAO.DLL")

it askes me if I want to enter a break loop because there's an "Assignment to protected symbol (XXXX)", it asks me several times, about symbols like "Append Chunk", "BeginTrans", "Cancel" (which are probably all in DAO), to which I respond NO to all, then the function returns T.  

 

But then 

(setq DBEngine (vlax-create-object "DAO.DBEngine"))

returns nil.

 

Anyone have any idea what to do?  This library is unbelieveablyuseful, surely these 2 unbuhlieveable products play nice with each other, right?

0 Likes
1,081 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

Your referring to lisp so opening database

(setq xls-app (vlax-get-or-create-object "Excel.Application")) is for excel

(setq word-app (vlax-get-or-create-object "Word.Application")) is for Word

What does this return for you

(setq acc-app (vlax-get-or-create-object "Access.Application")) worked for me

 

Access is a bit like excel can do rows and columns. Is this not what you want ?

 

 

 

0 Likes
Message 3 of 6

ivanstarr3
Contributor
Contributor
Sea haven,



That will get you an instance of Access.Application, and yes that code will
get you an application from the Access library running on the ROT, but I
need a DBEngine object from the DAO library. The DAO library comes with
Access, it actually is the guts of the database part of the Access
application, but it is NOT the application itself. The question remains,
why doesn't (setq DBEngine (vlax-create-object "DAO.DBEngine")) work? The
question is, how does one create a "DBEngine" object from the "DAO"
library, if not (setq DBEngine (vlax-create-object "DAO.DBEngine"))?



Thanks, Ivan


0 Likes
Message 4 of 6

ivanstarr3
Contributor
Contributor

Ok all, I got a bit coser to the solution myself.  As it turns out, an instance of DBEngine is a property of the Access.Application object, so you can grab it there by instantiating Access.  But I believe that DAO comes with Windows but I (and others) have no idea how to get a copy of it outside of Access.  It's gettable in Excel too, where it it is automatically instantiated.

 

But the problem still remains without access - how do you get an instance of DBEngine without Access?

0 Likes
Message 5 of 6

Sea-Haven
Mentor
Mentor

Sounds like a question to Autodesk and Microsoft, good luck.

 

What is the file name ?

 

I am having same problem finding a dll in CIV3d that's in Achitectural, I am sure it exists but what is its name. 

0 Likes
Message 6 of 6

ivanstarr3
Contributor
Contributor
Yeah, I agree. What is it's name? Of the problem? I'm not sure... How
about "why the heck can't we instantiate DBEngine when it supossedly comes
as part of Windws?" maybe to force us to buy Access? I don't know. But
something this basic and essential SHOULD come as part of an operating
system. If you know the name, tell me, because I wanna know too. If you
have a contact at MS to discuss this tell me. Otherwise Ima gonna post it
on Stack Overflow if you all have no idea.

Ivan
0 Likes