Talking to a .net app

J

John

Hi

My access app needs to receive a command like "GotoRecordwithID=10" from a
vb.net app. This command is for a specific form which may not be even be
open at the time. How can I manage this one way (vb.net -> access)
communication?

Thanks

Regards
 
J

John

Hi Tom

I was hoping for something lightweight as the communication is minimal and
it is just one string occasionally sent form time to time.

Thanks

Regards
 
M

m3

I'm not sure if it will do! There are two ways:

1) From within your vb program you 'Shell' your access program with /cmd
GotoRecordwithID=10
2) Create a batch file form your vb program to run your access program with
the above /cmd GotoRecordwithID=10, save it somewhere, you then double-click
it to run.

The command look something like this :

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "yourAccessProgram"
/cmd GotoRecordwithID=nn (nn to be set by your vb program)

In your access program the 'GotoRecordwithID=10' can be return by 'Command'
function.
 
A

Arvin Meyer [MVP]

Don't even try going to an unopened form. I won't work. Use a SQL statement
in the vb.net app like:

strSQL = "SELECT PersonID, * "
strSQL = strSQL & " FROM [H:\Database\Data.mdb].qryAddresses;"
strSQL = strSQL & " WHERE PersonID=[Enter an ID];"
 
T

Tom van Stiphout

Here is a poor-mans version I have used successfully. It only works if
you know your way a bit around Windows API calls. The steps are:
Use FindWindow to find the window handle of a (possibly hidden) Access
form with a specific title.
Use SetWindowText to change its caption to something like
GotoRecordwithID=10.
Resize the form using MoveWindow. This triggers the Form_Resize event
in Access.

In Access, respond to the Form_Resize by doing whatever you want done.
Open a form and move to some record, for example.
Set the caption back to normal.

-Tom.
 
J

John

Hi Tom

This sounds good. Any chance you can post the calling app's code?

Many Thanks

Regards
 
T

Tom van Stiphout

I remember doing this, but not in which project. The APIs I mentioned
are accurate though, and finding help on them should not be difficult.

-Tom.
 
T

Tony Toews [MVP]

Tom van Stiphout said:
Here is a poor-mans version I have used successfully. It only works if
you know your way a bit around Windows API calls. The steps are:
Use FindWindow to find the window handle of a (possibly hidden) Access
form with a specific title.
Use SetWindowText to change its caption to something like
GotoRecordwithID=10.
Resize the form using MoveWindow. This triggers the Form_Resize event
in Access.

In Access, respond to the Form_Resize by doing whatever you want done.
Open a form and move to some record, for example.
Set the caption back to normal.

That's a very interesting approach. Nice sideways thinking.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
S

sakamotoyukihiro

John said:
Hi

My access app needs to receive a command like "GotoRecordwithID=10" from a
vb.net app. This command is for a specific form which may not be even be
open at the time. How can I manage this one way (vb.net -> access)
communication?

Thanks

Regards
 

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