Hi
I'm trying to make a VB program for accounting calls comming from a Nortel Meridian PBX through serial port, This is the program:
Dim Acu As String
Dim Coun As Integer
Dim Buffer As String
Dim Varix As String
Private Sub Form_Load()
MSComm1.CommPort = 1 'Open COM1
MSComm1.PortOpen = True
End Sub
'************Read Data From the PBX
Private Sub MSComm1_OnComm()
Dim VariData As String
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
VariData = Buffer
RichTextBox1.SelStart = Len(RichTextBox1.Text)
RichTextBox1.SelText = VariData
Call ProcessData(VariData)
End Select
End Sub
'*********Process Received Data
Private Sub ProcessData(VariData As String)
Varix = Varix + VariData 'add data
If InStr(Varix, vbCrLf) Then 'If receive VbCrLf process
'Print "Found VbCrLf"
Print Varix
Varix = ""
Buffer = ""
End If
End Sub
A pbx call has this format:
N 011 00 226 T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
The 2 lines from a call ends with VbCrLf, So I would had to receive the information as:
N 011 00 226 T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
But I receive:
N 008 00 226
T000005 04/16 16:54 00:00:04 A 92541123
& 0
and in The next call I receive:
000 0000
N 011 00 226
T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
I want I join all the data coming from one call in a variable for processing the call information:
Any suggestion? Thanks
I'm trying to make a VB program for accounting calls comming from a Nortel Meridian PBX through serial port, This is the program:
Dim Acu As String
Dim Coun As Integer
Dim Buffer As String
Dim Varix As String
Private Sub Form_Load()
MSComm1.CommPort = 1 'Open COM1
MSComm1.PortOpen = True
End Sub
'************Read Data From the PBX
Private Sub MSComm1_OnComm()
Dim VariData As String
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
VariData = Buffer
RichTextBox1.SelStart = Len(RichTextBox1.Text)
RichTextBox1.SelText = VariData
Call ProcessData(VariData)
End Select
End Sub
'*********Process Received Data
Private Sub ProcessData(VariData As String)
Varix = Varix + VariData 'add data
If InStr(Varix, vbCrLf) Then 'If receive VbCrLf process
'Print "Found VbCrLf"
Print Varix
Varix = ""
Buffer = ""
End If
End Sub
A pbx call has this format:
N 011 00 226 T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
The 2 lines from a call ends with VbCrLf, So I would had to receive the information as:
N 011 00 226 T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
But I receive:
N 008 00 226
T000005 04/16 16:54 00:00:04 A 92541123
& 0
and in The next call I receive:
000 0000
N 011 00 226
T000002 04/16 16:55 00:00:00 A 92541123
& 0000 0000
I want I join all the data coming from one call in a variable for processing the call information:
Any suggestion? Thanks