PDA

View Full Version : MS Access 2000


Bumpus
04-19-2002, 05:04 PM
In MS Access 2000, is there a way to send a string (CR would work) out of a comm port? I would gu8ess it's done through a macro, but for the life of me, I can't figure out how! Thanks!

Paul Komski
04-19-2002, 08:00 PM
Not quite sure what you are trying to attempt. Is this an ODBC or Modem string or other string?

The actual string could be stored as either a user-defined constant or function for use later. Alternatively the SendKeys Action (for a Macro) or SendKeys Method (for an AccessBasic script) could be used to mimic the actual pressing of keystrokes; (this could include a pause).

str(13) is the code for <CR> in scripting and ~ the "keystroke-equivalent" of pressing the ENTER key for a SendKeys Statement.

I haven't yet found a way to send/print any string direct to a COM port (which doesn't mean it can't be done); the nearest would be to open another application and send the string to it. Hope this is of some use; but it would be handy to know what you are attempting to ahieve.

------------------
Take nice care of yourselves - Paul
"For a Pandora's box upgrade to IE6 (IEsicks that is)"

Bumpus
04-20-2002, 07:58 AM
What I need to do is to send a string, any string (in ASCII, out a comm port to an RS232 device, that in turn will send one back. I have the means to import data from this RS232 device into Access, but can't figure out how to send one out.

Hope this made it a little clearer.

Paul Komski
04-20-2002, 04:56 PM
The ActiveX MSCOMM CONTROL (http://www.yes-tele.com/mscomm.html) could be used but would need downloading, registering and configuring for your purposes within MSAccess.

If the object or application that you are connecting-to supports DDE or OLE automation with MSAccess then once a link was established (using VBA code) you could "talk" in both directions.

If the object is a data source then you should be able to output to it using "import/export".

The only other way that I can think of would be to set up a printer for the relevant serial port; and then print your "text" to that printer from MSAccess.

Hope this is of some use.



------------------
Take nice care of yourselves - Paul
"For a Pandora's box upgrade to IE6 (IEsicks that is)"

Paul Komski
04-21-2002, 08:21 PM
Just an afterthought. How do you import the data and is it stored in a table (if so is it real or linked) or in something else? http://www.PCGuide.com/ubb/smile.gif



------------------
Take nice care of yourselves - Paul
"For a Pandora's box upgrade to IE6 (IEsicks that is)"

Bumpus
04-22-2002, 09:47 AM
It is imported directly into a table from another software package. This package runs in the background and creates a link from the RS232 device directly to a table in Access. However, it does not provide communications from Access to the Device, only from the device to Access.

Thanks for helping!

Paul Komski
04-23-2002, 08:06 PM
It's still a bit unclear what sort of data is read from the RS232 device. Perhaps it is read only or "unpokable" in someway, which would make accessing it pointless - unless these could be changed.

If it is a true database, then its documentation should enable you to have installed the correct ODBC library for Access to utilise and also indicate how to point to the COM port.

If it is a device like scales or a communication device, then you can only access (using DDE or OLE automation) those parts of it which it has been programmed to enable or "expose" for these tasks. Using DDEinitiate etc in VBA would be the most common way of opening such a channel from MSAccess. I doubt that (even if the device supports a two-way channel) that you will be able to program it using macros but will either have to use VBA script in the modules or use third-party software - just as you are already doing for imports.

Setting up ActiveX controls on Forms (such as the MSCOMM control) is not always straightforward either and would almost certainly involve writing at least one event procedure in VBA, though this might be the only way of communicating with the device.


------------------
Take nice care of yourselves - Paul
"People in glasshouses ..... shouldn't undress during daylight!"

Bumpus
04-23-2002, 08:58 PM
Thanks for all your help, but I think I'm in over my head!