为什么我从串口读出来的数据不对?
Private Sub MSComm1_OnComm()
Dim txtBuf As String
Dim i As Integer
With MSComm1
Select Case .CommEvent
Case comEvReceive
txtBuf = .Input
'为什么读出来的txtbuf有时候对,有时候不对,我是与超级终端读的
'比较(超级终端都是对的)正常数据比如是:
‘04:49 27/01/02 96512628 Denied
’可是很多时候是读不全的,而且正确获得是上一次刷卡记录?
Debug.Print txtBuf 'nowgetstr 'Right(txtResponse, nowlen)
'下面是从txtBuf 中提取卡号
If Not GetCardId(txtBuf) Then'如果提取错误就退出
Exit Sub
End If
'按此卡号查询员工信息
GetStaffInfo cardid
'把刷卡记录添加到数据库中
AddCheckOnInfo cardid
End Select
End With
End Sub