It is pretty simple, assuming you buffer the incoming data with a staic var as shown above then once you add the latest data to the var you would check to see if that terminator character exists in the string. If so parse the string and process the data up to the CR then leave any additional data that may be present in the buffer
Code:Static InBuffer As String Dim Transaction As String, Pos As Integer InBuffer = InBuffer & MSComm1.Input Pos = InStr(InBuffer, vbCr) If Pos > 0 Then Transaction = Left$(InBuffer, Pos - 1) Debug.Print "Transaction=" & Transaction If Len(InBuffer) > Pos Then InBuffer = Mid$(InBuffer, Pos + 1) Else InBuffer="" End If End If




Reply With Quote
