Solved

Only 49 characters please..

Posted on 1998-08-27
2
123 Views
Last Modified: 2011-09-20
Hello there...

I had a great time reading data from a serial port and then placing it into an Access table.  However the data that comes across from the MSComm1.Input is sometimes to long.  Is there anyway to allow only 49 characters in at a time? AND THEN CLEAR THE BUFFER?
Here is what my code looks like:

Private Sub Receive_Click()

Dim Db As Database
Dim rs As Variant

   
Text1.Text = MSComm1.Input
    'Open Database
Set Db = Workspaces(0).OpenDatabase("C:\Program Files\Microsoft Visual Basic\serial")
    'Open table
Set rs = Db.OpenRecordset("tbl_main", dbOpenDynaset)
   
rs.AddNew
rs("fld_String") = Text1.Text
rs.Update                             ' Save changes.
rs.Move 0, rs.LastModified            ' Go to new record
rs.Close                              ' Close Table.
Db.Close                              ' Close Database

End Sub
0
Comment
Question by:Nelmarcas
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 50 total points
ID: 1431369
Insert the line:

MSComm1.InputLen = 49

Before the Line:

Text1.Text = MSComm1.Input
0
 

Author Comment

by:Nelmarcas
ID: 1431370
Thank you very much, I figured it out too late.  Thanks for the help..


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 115
How to debug this code 7 64
How to make an ADE file by code? 11 94
IF ELSE Statement in Excel Macro VBA 16 75
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 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