Y
yanto
Hi,
I create an application to access finger print attendance device using
their SDK, the source code:
Dim vMachineNumber
Dim bConnected As Boolean
Dim CZKEM1 As Object
Private Sub cmdConnect_Click()
Dim ver As String
Dim dwEnrollNumber As String
Dim dwVerifyMode As Long
Dim dwInOutMode As Long
Dim timeStr As String
Dim i As Long
Dim dwMachineNum, dwEMachineNum, dwYear, dwMonth, dwDay, dwHour,
dwMinute, dwSecond, dwWorkcode, dwReserved As Long
Dim fso, txtfile
Dim LogStr As String
If bConnected Then
CZKEM1.Disconnect
cmdConnect.Caption = "Connect"
bConnected = False
lblInfo.Caption = ""
Else
'Make a connection
If CZKEM1.Connect_Net("192.168.1.125", 4370) Then
If CZKEM1.GetFirmwareVersion(vMachineNumber, ver) Then
lblInfo.Caption = "Version=""" & ver & """"
If CZKEM1.GetDeviceIP(vMachineNumber, ver) Then
lblInfo.Caption = lblInfo.Caption & ", IP=" & ver
End If
cmdConnect.Caption = "Disconnect"
bConnected = True
End If
Else
Beep
lblInfo.Caption = "Connect fail."
End If
If CZKEM1.ReadGeneralLogData(1) Then
Set dbs = CurrentDb()
While CZKEM1.SSR_GetGeneralLogData(1, dwEnrollNumber,
dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute,
dwSecond, dwWorkcode)
DoEvents
i = i + 1
'Write to database
strSQL = "INSERT INTO tblAttendants (EmployeeID, AttDate,
AttTime, Status) VALUES ('" & _
CStr(dwEnrollNumber) & "',#" & _
CDate(CStr(dwMonth) + "/" + CStr(dwDay) + "/" + CStr
(dwYear)) & "#,#" & _
CStr(dwHour) + ":" + CStr(dwMinute) + ":" + CStr
(dwSecond) & "#,'" & _
IIf(dwInOutMode = 0, "IN", "Out") & "');"
'MsgBox strSQL
dbs.Execute strSQL, dbFailOnError
Wend
dbs.Close
Set dbs = Nothing
End If
MsgBox "Proses ambil data selesai!"
frmSubAttendant.Requery
End If
End Sub
Private Sub Form_Load()
Dim s As String
bConnected = False
Set CZKEM1 = New CZKEM
'Set CZKEM1 = CreateObject("CZKEM")
CZKEM1.BASE64 = 0
vMachineNumber = 1
CZKEM1.GetSDKVersion s
End Sub
Private Sub Form_Unload(Cancel As Integer)
CZKEM1.Disconnect
Set CZKEM1 = Nothing
End Sub
this works good, untill I quit the application and I got an error: "Ms
Access has generated error and will be closed by window. You will need
to restart the program. An error log is being created"
and suddently quit from application.
The question are:
1. Do I miss something in my code?
2. Where is the error log created?
TIA
Yanto
I create an application to access finger print attendance device using
their SDK, the source code:
Dim vMachineNumber
Dim bConnected As Boolean
Dim CZKEM1 As Object
Private Sub cmdConnect_Click()
Dim ver As String
Dim dwEnrollNumber As String
Dim dwVerifyMode As Long
Dim dwInOutMode As Long
Dim timeStr As String
Dim i As Long
Dim dwMachineNum, dwEMachineNum, dwYear, dwMonth, dwDay, dwHour,
dwMinute, dwSecond, dwWorkcode, dwReserved As Long
Dim fso, txtfile
Dim LogStr As String
If bConnected Then
CZKEM1.Disconnect
cmdConnect.Caption = "Connect"
bConnected = False
lblInfo.Caption = ""
Else
'Make a connection
If CZKEM1.Connect_Net("192.168.1.125", 4370) Then
If CZKEM1.GetFirmwareVersion(vMachineNumber, ver) Then
lblInfo.Caption = "Version=""" & ver & """"
If CZKEM1.GetDeviceIP(vMachineNumber, ver) Then
lblInfo.Caption = lblInfo.Caption & ", IP=" & ver
End If
cmdConnect.Caption = "Disconnect"
bConnected = True
End If
Else
Beep
lblInfo.Caption = "Connect fail."
End If
If CZKEM1.ReadGeneralLogData(1) Then
Set dbs = CurrentDb()
While CZKEM1.SSR_GetGeneralLogData(1, dwEnrollNumber,
dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute,
dwSecond, dwWorkcode)
DoEvents
i = i + 1
'Write to database
strSQL = "INSERT INTO tblAttendants (EmployeeID, AttDate,
AttTime, Status) VALUES ('" & _
CStr(dwEnrollNumber) & "',#" & _
CDate(CStr(dwMonth) + "/" + CStr(dwDay) + "/" + CStr
(dwYear)) & "#,#" & _
CStr(dwHour) + ":" + CStr(dwMinute) + ":" + CStr
(dwSecond) & "#,'" & _
IIf(dwInOutMode = 0, "IN", "Out") & "');"
'MsgBox strSQL
dbs.Execute strSQL, dbFailOnError
Wend
dbs.Close
Set dbs = Nothing
End If
MsgBox "Proses ambil data selesai!"
frmSubAttendant.Requery
End If
End Sub
Private Sub Form_Load()
Dim s As String
bConnected = False
Set CZKEM1 = New CZKEM
'Set CZKEM1 = CreateObject("CZKEM")
CZKEM1.BASE64 = 0
vMachineNumber = 1
CZKEM1.GetSDKVersion s
End Sub
Private Sub Form_Unload(Cancel As Integer)
CZKEM1.Disconnect
Set CZKEM1 = Nothing
End Sub
this works good, untill I quit the application and I got an error: "Ms
Access has generated error and will be closed by window. You will need
to restart the program. An error log is being created"
and suddently quit from application.
The question are:
1. Do I miss something in my code?
2. Where is the error log created?
TIA
Yanto