Solved

MSComm Control Blues

Posted on 1999-01-07
4
197 Views
Last Modified: 2013-12-26
Hi, my problem is this.  I am storing data coming from a device through my serial port.  Easy huh!  I have viewed the data using the hyper terminal and everything comes in line by line.  Great!  I have my application stroing the data into an Access table and it works great.  However, the data is broken into two different parts.  Well, then I removed all the code dealing with Access and used the immedate window to view what was coming across.  AHHHHH!  What's going on?  The hyper terminal shows the data coming in line by line as such :
PORT  1 MAT    2 OFF LINE         JAN 07, 1999  09:21:23

It looks great in hyper terminal! But why when I view it in the immediate window, it comes across like this

PORT  1 MAT    2 OFF LINE  
        JAN 07, 1999  09:21:23
These are two seperate lines.  I increased the buffer size and made sure that the inbuffer count was big enough to accept this string.  Now I have two records in Access.  Help, I have exhausted my documentation.  Please.
0
Comment
Question by:Nelmarcas
  • 2
4 Comments
 
LVL 3

Expert Comment

by:jjbyers
ID: 1489485
Have you tried checking all the characters in the string for a chr(13) and/or chr(10) then strip these out?

0
 

Expert Comment

by:T38Jet
ID: 1489486
obviously there's a carriage return after the E in "OFF LINE"

I tend to agree with jjbyers, but the problem with stripping out carriage returns and/or line feeds is which ones to strip out? (unless you have an exact number of bytes you ALWAYS receive for each record in the table)


0
 
LVL 3

Accepted Solution

by:
cognition earned 50 total points
ID: 1489487
Dim lni as integer
Dim lnPos as integer
For lni = 1 to Len(String)
    If Chr(Mid(lni, String, 1)) < 32 Then
        String = Mid(1, String, lni - 1) + " " + Mid(lni + 1, String, Len(String))
Next


0
 
LVL 3

Expert Comment

by:jjbyers
ID: 1489488
I would strip all CRLF's out. But you could also replace them with another character using the MID function within a loop.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question