Link to home
Start Free TrialLog in
Avatar of Peter Groves
Peter Groves

asked on

execute vb.net code from within MSaccess

Is it possible to run some VB.NET code from within MSAccess!   MSaccess is my main frontend and I have
a VB.net module I'd need to run!  This is a service to access a webservice and I suppose I could write equivalent code in VBA
but was hoping to start adding VB.net code gradually to later convert everything to VB.net!  I've never use VB.net
but want to start learning it  piece by piece!

This is a snippet of code to give you an idea!  I ask because there are visual studio .NET libraries available so I assume I can!

 
Dim manualWebClient As New System.Net.WebClient
            manualWebClient.Headers.Add("Content-Type", "application/soap+xml;  charset=utf-8")
            Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes(
                "<soap12:Envelope xmlns:xsi='http: //www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>

Just looking for a few good suggestions to point me in the right direction!

Pete
Avatar of PatHartman
PatHartman
Flag of United States of America image

You can use the Shell command to run other programs so if the code is "executable" similar to the way a .bat file is executable, then Shell will run it.  I don't have any samples handy but I don't remember it being complicated so Help should "help".
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
another possible way is to encapsulate your existing codes into some webapi or wcf service at your .net end, meaning to say, let .net do its own work. And then let your Access send http request to that interface.

by doing that, the impact to your Access application could be minimal.

hope this make sense.
Compile your vb.net project as COM visible dll, add reference to it from access and use.
Avatar of Peter Groves
Peter Groves

ASKER

Thanks guys, I was hoping for a less complicated approach since there seemed to be libraries there to handle vb.net code.
I might just go ahead and convert the .net functions to VBA. I have another application that I'll do in .NET and once I'm familiar with .NET then I'll go back when I'm ready to convert this whole application to VB.NET and possibly ASP.NET. I'd rather not mix the 2.

Pete
Thanks guys, I was hoping for a less complicated approach since there seemed to be libraries there to handle vb.net code.
So, I guess you didn't try my suggestion to use Shell?
No pat cuz the .NET code wasn't completely written yet and I was hoping for a more integrated approach.
However I just found out the data I needed to access is hosted on the same server. We just created a view!

Can't get more integrated than that!  

Appreciate your Help Pat!

Pete
So, just out of curiosity, since you didn't use Scott's solution either, why select it as the answer?
I was asking if I could use .NET code IN access. Since I saw libraries that refer to it!  You suggested I try a shell but thats not
what I was expecting!   But don't fret as I'm posting another more direct question!

Pete
I have no problem but accepting random answers doesn't really help others who search for solutions.