Board index » delphi » How do I call Access VB-code from Delphi -please help

How do I call Access VB-code from Delphi -please help

Hello!

How do I call VB-code in a Access 97 DB.
The general idea is to make a link to an external Access DB (this is done in
VB-code in the DB).
I've tried to make the call (to function MakeLink) from a query:

SELECT DummyTable.DummyField
FROM DummyTable
WHERE (((DummyTable.DummyField)=MakeLink()));

But when executing the query I get a general SQL error telling : undefined
function 'MakeLink' in expression.
The query works fine when running directly from Access.

I use:
  Delphi V. 3.02
  MS Access 97
  ODBC V. 3.0.23.1

Please help anyone

Thanks,
Peter Kristensen

 

Re:How do I call Access VB-code from Delphi -please help


I'll stand corrected, but I think to do what you want Access has to be
running, doesn't it? Wouldn't it be simpler to write the function in the
Delphi and add a calculated field to the field list? The calculated field
can then get its value from the function. Certainly should be much faster
than calling an interpreted VB routine in Access, I think...

Pierre

Quote
Peter Kristensen <hjuls...@hotmail.com> wrote in message

news:7lptlb$a0d3@forums.borland.com...
Quote
> Hello!

> How do I call VB-code in a Access 97 DB.
> The general idea is to make a link to an external Access DB (this is done
in
> VB-code in the DB).
> I've tried to make the call (to function MakeLink) from a query:

> SELECT DummyTable.DummyField
> FROM DummyTable
> WHERE (((DummyTable.DummyField)=MakeLink()));

> But when executing the query I get a general SQL error telling : undefined
> function 'MakeLink' in expression.
> The query works fine when running directly from Access.

> I use:
>   Delphi V. 3.02
>   MS Access 97
>   ODBC V. 3.0.23.1

> Please help anyone

> Thanks,
> Peter Kristensen

Re:How do I call Access VB-code from Delphi -please help


Sorry I didn't make my self clear..
What I want is to make a link from one Access MDB to another Access MDB
(this is done in the VB-code). I can't make a static link because the DB to
link to might not always exist.
The SELECT I descriped below is just a try to call the VB function
(MakeLink()).
I hope that this made my problem more clear.

But thanks anyway,
Peter

Pierre du Parte skrev i meddelelsen <7lq09r$a...@forums.borland.com>...

Quote

>I'll stand corrected, but I think to do what you want Access has to be
>running, doesn't it? Wouldn't it be simpler to write the function in the
>Delphi and add a calculated field to the field list? The calculated field
>can then get its value from the function. Certainly should be much faster
>than calling an interpreted VB routine in Access, I think...

>Pierre

Re:How do I call Access VB-code from Delphi -please help


Quote
> The general idea is to make a link to an external Access DB (this is done
in
> VB-code in the DB).

You can try to do this within DAO COM interface.

Import to project Microsoft DAO 3.5 Object library (inteface in Dao2535.tlb)
and start to automate DAO at the same
manner done in Access DB.

I do automate DAO (DB compression, repair etc.) within Delphi 4, and almost
all things done in Access VBA you can do from Delphi.

Vadim Krochak

088522...@doar.net

Other Threads