calling from VB functions of MS Access 2002

calling from VB functions of MS Access 2002

Post by Sven =:\ » Wed, 21 May 2003 02:15:47



Hi guys,

as simple as the problem sounds as dificult it is to solve it :o)  I'm
trying to run functions written in MS Access 2002 using PIAs. Unfortunately,
my code isn't running although it's the same shown in MSDN.

I am not able to run such a function. While calling the 'Run' method of the
Access object an error occures:
"System.Runtime.InteropServices.COMException".

The Access file "test.adp" exists and also the Function named "Test1" which
gets one String Parameter.

Is somebody there who can help me?

Thx very much in advance.

Sven =:)

------------------------

Dim myAccess As Microsoft.Office.Interop.Access.Application

Dim lResult As Object

myAccess = New Microsoft.Office.Interop.Access.ApplicationClass()

filename = "C:\sd&m AG\projects\Pesionskasse\PKGB
Internet.Spiegel\prototype\dummy.adp"

myAccess.OpenAccessProject("C:\test.adp", False)

lResult = myAccess.Run("Test1", "Joe")

...

 
 
 

calling from VB functions of MS Access 2002

Post by Mary Chipma » Wed, 21 May 2003 06:04:10


You are trying to launch an ADP in the UI using COM Interop?

What is Test1 supposed to do? It would be better to write it in
managed code.

-- Mary
MCW Technologies
http://www.mcwtech.com


>Hi guys,

>as simple as the problem sounds as dificult it is to solve it :o)  I'm
>trying to run functions written in MS Access 2002 using PIAs. Unfortunately,
>my code isn't running although it's the same shown in MSDN.

>I am not able to run such a function. While calling the 'Run' method of the
>Access object an error occures:
>"System.Runtime.InteropServices.COMException".

>The Access file "test.adp" exists and also the Function named "Test1" which
>gets one String Parameter.

>Is somebody there who can help me?

>Thx very much in advance.

>Sven =:)

>------------------------

>Dim myAccess As Microsoft.Office.Interop.Access.Application

>Dim lResult As Object

>myAccess = New Microsoft.Office.Interop.Access.ApplicationClass()

>filename = "C:\sd&m AG\projects\Pesionskasse\PKGB
>Internet.Spiegel\prototype\dummy.adp"

>myAccess.OpenAccessProject("C:\test.adp", False)

>lResult = myAccess.Run("Test1", "Joe")

>...


 
 
 

calling from VB functions of MS Access 2002

Post by Sven =:\ » Wed, 21 May 2003 15:12:02


Hi Mary,

of course! I would prefer managed code. But there is a "MS Access 2002"
application I'm going to use. So image "Test1" returns just a string. How to
run "Test1" to retrieve this string?

Sven =:)



> You are trying to launch an ADP in the UI using COM Interop?

> What is Test1 supposed to do? It would be better to write it in
> managed code.

> -- Mary
> MCW Technologies
> http://www.mcwtech.com


> >Hi guys,

> >as simple as the problem sounds as dificult it is to solve it :o)  I'm
> >trying to run functions written in MS Access 2002 using PIAs.
Unfortunately,
> >my code isn't running although it's the same shown in MSDN.

> >I am not able to run such a function. While calling the 'Run' method of
the
> >Access object an error occures:
> >"System.Runtime.InteropServices.COMException".

> >The Access file "test.adp" exists and also the Function named "Test1"
which
> >gets one String Parameter.

> >Is somebody there who can help me?

> >Thx very much in advance.

> >Sven =:)

> >------------------------

> >Dim myAccess As Microsoft.Office.Interop.Access.Application

> >Dim lResult As Object

> >myAccess = New Microsoft.Office.Interop.Access.ApplicationClass()

> >filename = "C:\sd&m AG\projects\Pesionskasse\PKGB
> >Internet.Spiegel\prototype\dummy.adp"

> >myAccess.OpenAccessProject("C:\test.adp", False)

> >lResult = myAccess.Run("Test1", "Joe")

> >...

 
 
 

calling from VB functions of MS Access 2002

Post by Mary Chipma » Thu, 22 May 2003 04:08:34


Why? An ADP simply represents a connection to a SQL Server database
along with the forms and reports package. Code in the adp is intended
to run from the Access UI. You can't run the Access UI from .NET. If
you need to return a string from SQL Server, you'd be better off doing
so directly using VB.NET/ADO.NET.

-- Mary
MCW Technologies
http://www.mcwtech.com


>Hi Mary,

>of course! I would prefer managed code. But there is a "MS Access 2002"
>application I'm going to use. So image "Test1" returns just a string. How to
>run "Test1" to retrieve this string?

>Sven =:)



>> You are trying to launch an ADP in the UI using COM Interop?

>> What is Test1 supposed to do? It would be better to write it in
>> managed code.

>> -- Mary
>> MCW Technologies
>> http://www.mcwtech.com


>> >Hi guys,

>> >as simple as the problem sounds as dificult it is to solve it :o)  I'm
>> >trying to run functions written in MS Access 2002 using PIAs.
>Unfortunately,
>> >my code isn't running although it's the same shown in MSDN.

>> >I am not able to run such a function. While calling the 'Run' method of
>the
>> >Access object an error occures:
>> >"System.Runtime.InteropServices.COMException".

>> >The Access file "test.adp" exists and also the Function named "Test1"
>which
>> >gets one String Parameter.

>> >Is somebody there who can help me?

>> >Thx very much in advance.

>> >Sven =:)

>> >------------------------

>> >Dim myAccess As Microsoft.Office.Interop.Access.Application

>> >Dim lResult As Object

>> >myAccess = New Microsoft.Office.Interop.Access.ApplicationClass()

>> >filename = "C:\sd&m AG\projects\Pesionskasse\PKGB
>> >Internet.Spiegel\prototype\dummy.adp"

>> >myAccess.OpenAccessProject("C:\test.adp", False)

>> >lResult = myAccess.Run("Test1", "Joe")

>> >...

 
 
 

1. VB.net vs MS Access 2002 as a front end to MS SQL server data

Hello, I am a beginner in Visual basic.  I am however, fairly competent in
VBA within Access and Excel.

At our company, we are determining whether to use VB.net or MS Access 2002
as a front-end to SQL Server data.  I am compiling a list of pros and cons.

Can some of you experts help me out with your comments?  Thanks alot.

2. Wanted: PCL viewer (Ghostspript for PCL :-)

3. VB.net Com DLL's called from MS Access XP VBA, locks MS Access

4. SNMP management for 7.3.2.2

5. Nested transactions and MS Access 2002

6. Locking, Novell, Btrieve Create

7. Adding MS Access 2002 Reference to a .NET project

8. using Visual Source Safe with MS Access 2002

9. OleDbCommand parameters and MS Access 2002

10. Use ASPx to fire MS Access 2002 macro

11. calling a javascript function from a vb function

12. Slow MS Access from .NET if open in VB6 or MS Access