Communication between MS Access and VB.NET

G

Gerald Bader

Hello!

I've got an MS Access Application and a VB.NET Application.

Now I want to to exchange information in real time between these two
applications.

For example the VB.NET application wants to know the name of the active Form
within the Access application. Or the Access application wants to know the
date within a textbox of the VB.NET application. And so on...

Both applications can run only once on a computer.

The problems are:
- How can VB.NET access the Access application?
- How can Access access the VB.NET application?
- Once the VB.NET application accessed the Access application, it can run
functions within the Access application. Is this possible reversely, too?

In priciple the two should be able to "talk" with each other.

I know that both applications could use DDE - but there must be a more
up-to-date option.

Any idea, how I can arrange this?
Many thanks already in advance for your help!


Greetings from Austria

Gerald
 
O

One Handed Man \( OHM - Terry Burns \)

Your best bet is to get hold of Visual Studio Tools For Office, this is the
most flexible way to interact with Office applications using VS2003 or
above.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
G

Gerald Bader

Hi!

Thanx for your fast reply!

The problem is, that the existing Access application is created with MS
Access 2000. So there are no .NET capabilities available.
Moreover I use the VS.NET 2002.
And I'm bound to these Versions.

What alternatives to DDE do exists in my case?


Greetings

Gerald
 
O

One Handed Man \( OHM - Terry Burns \)

You can still use COM Interop, simply add a reference to the Access DDL in
your references section to access the ACCESS object hierarchy.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
A

aaj

I know it probably isn't as technical as it might be, but could you not use
the access database as a common entity between the two.

Maybe you could use events from both the .net and the access, and write the
current information from each to a common table.

Each app could then be triggered (timer/interrupt?) to see the current
status of the other from the common table

hope it helps

Andy
 
G

Gerald Bader

Hi again!

I know COM interop.

But what I mean is, that these two applications are running.
And while they are running, they need to "find" each other in the current
Windows-Session and "talk" to each other.

This is what I need to achive.


Greetings

Gerald
 
G

Gerald Bader

Hi!

Thanks for your reply.

aaj said:
I know it probably isn't as technical as it might be, but could you not use
the access database as a common entity between the two.

Maybe you could use events from both the .net and the access, and write the
current information from each to a common table.

Each app could then be triggered (timer/interrupt?) to see the current
status of the other from the common table

What I meant with "real-time" is that one application should "ask": "What's
your current form?" and the other one should immediately "answer": "Its name
is 'Main-Form'."
If I use a timer, the user always had to wait until the Timer-Event was
fired.

I rather thought of the capability of the two applications to run functions
each within the other application.
But the problem is how to "find" the "application" object (or how you want
to call it) of each the other application within the current Windows
session.

Besides - what is an 'interrupt'?

Or is there possibility to send any Message from one application to another,
never minding if it is a .NET or a COM application?
hope it helps

Andy


Gerald
 
C

Cor Ligthert

Gerald,
But what I mean is, that these two applications are running.
And while they are running, they need to "find" each other in the current
Windows-Session and "talk" to each other.

Just as advice forget it. Take the approach from AAJ,

When you do this you should have to make in my opinion a service which
accesses queues.
Probably that will be easier for VBNet than for Access, so you should start
your investigation with Access. However I would never take one minute in
that because with every new version you probably have to redesign

Just my thouhgt,

Cor
 
K

Ken Tucker [MVP]

Hi,

Visual Studio tools for office only helps with word and excel.

Ken
-----------------
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
Your best bet is to get hold of Visual Studio Tools For Office, this is the
most flexible way to interact with Office applications using VS2003 or
above.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
A

aaj

Hi again

There are probably better ways of doing what you need then my suggestion,
but that said, I think it would be extremely simple to implement, but maybe
it wouldn't give you the functionality you need, but anyway, just to
continue down the thought process....

perhaps if you defined a list of events that you are interersted in, when
any of the events are triggered (in either app) you could write details to a
table which is accessible by both apps i.e.

in Access, if you load form "main", then you write to the table some thing
like "ACCESS,FORM_OPENED, main", when you close the form write
"ACCESS,FORM_CLOSED, main", you could be doing exactly the same in your .net
app this time something like "NET,FORM_OPENED, form7", when you close it
write "NET,FORM_CLOSED, form7", etc... i.e. this table would contiain a
running list of events, and the last entries of any particular category
would be the 'live' status available to be queried at any time. Maybe you
could even extend it to write a full structure to the data table.

Finding the status of App 1 on demand would be simple i.e. run a simple
query, that reads the result into a structure which you could use in the
rest of the App 2 program and vice-verse.

In each app, in the background maybe you could have some code that regulary
checked the status of your common table, that way if App 1 has a change then
within a very small time, app2 would know about it i.e something similar to
an event driven interrupt.

as I say, its probably no good to you anyway but always worth thinking of
different ways to solve a problem :cool:

hope its of some help

Andy

p.s. I'm not an expert, and I'm not sure if VB supports interupts, but in
the olden days I seem to remember you could set your software to check for
predifined events monitored in the background by the operating system, the
code would run without you worring you too much, but if the event occured
i.e. something changed, the OS would notify you, and you could set your
software to go off and do the necessary and when it was done, return back to
the place where the event occured (or that was the theory anyway )
 
O

One Handed Man \( OHM - Terry Burns \)

I dont think thats strictly true, the templates are pre-defined for Word and
Excell but the ability to communicate with access is there as is with
powerpoint.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top