MS Access communication via TCP/IP

bswg3549
bswg3549 used Ask the Experts™
on
Hi!  anyone have any luck with a "TELNET" like connection with MS ACCESS?    I send simple text commands to a connected unit via TELNET.    By TELNET I mean using a communications application that converses with a connected device via IP address.     Something like sending "readbuffer01" and a response like "0,00.4,2" is returned by the conneted device.   I do this over a TELNET application like Tera Term set up for IP of the connected device xxx.xxx.xxx.xxx format for IP and TCP/IP port 3602 emulating a VT100 terminal.   Any way that ACCESS can send commands and listen for a response like these terminal programs.   I am basically trying to automate data collection over the tcp/ip connection and store in a form/table.

Thanks!
Brian
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Can you do it? Yes. Should you do it? No.

What is your concrete use-case? What are your skills?

Cause my approach would be a Windows service written in .NET, cause it's much better suited for this kind of tasks.
President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012
Commented:
Unlike ste5an, I would not say "No".

 This has been done for many years in VB and VBA and you can do it in one of three ways:

1. Buy a 3rd party control.  i.e.:

http://www.dart.com/winsock-activex-api-library.aspx


2. Use the VB6 winsock control:

Beginers Winsock example
http://www.freevbcode.com/ShowCode.Asp?ID=1212

3. Or go low level and all the Winsock API directly:

https://www.keysight.com/main/editorial.jspx?ckey=1000001131:epsg:sud&id=1000001131:epsg:sud&nid=-32503.0.00&lc=eng&cc=US

 The last might be the most interesting as it's an example of instrument control.

 and there are tons of each of these out on the net.

Jim.
ste5anSenior Developer

Commented:
hmm, the question sounds like he wants to build a server, not a client.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
<<I am basically trying to automate data collection over the tcp/ip connection and store in a form/table.>>

 Sounds like a client to me....but it doesn't matter.  Access can do both.   I don't know that I'd leave it running 24x7.    I typically like to write small utilities that startup, do what they need to do, and shutdown.   Depends on the requirements though and I've done things both ways.

I wrote a time clock polling system in Access that used low level API calls to Ingersall Rand's Handpunch clocks over TCP/IP.   It ran 24 x 7 on a server without issue.

The problem though that you alluded to in suggesting .Net is that Access is a foreground app and you can't run it as a system service.  You can run it in the tray, but not as a true system service.   So you need a session that's logged in all the time.   It can be locked, but it needs an open session that has a desktop.

If you can live with that, then outside of that, it works fine for all sorts of things.

Jim.
bswg3549owner

Author

Commented:
I would actually want this to be event based from a form - so very infrequent.  I fill in an ip address of the connected remote device, access opens a socket and issues the command and reads the response.     I think the excel example you gave is very close to what I want to do, so need to do some studying.  I have made Access do a lot of weird things through VB, but the win socket thing is totally new to me, but it looks like what I want.  I really appreciate everyone quick response.   I am marking your answer as my solution as i firmly believe it will get me there.  Thanks!
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
Yes, from your question, the Excel VBA code smacks the closest and you don't need anything but Access.   It's the way I'd go.  Might be a little more work because your making low level calls, but all the basics of doing it are there.

Jim.
bswg3549owner

Author

Commented:
Thanks everyone - I REALLY appreciate your time!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial