I have error message when i run this script
QuerySelect = "SELECT a.DN, b.DIN, c.PIN, " & _
"c.UserName , b.Clock, d.ItemName " & _
"FROM ((ras_Device a INNER JOIN ras_AttRecord b ON a.DN=b.DN) " & _
"LEFT JOIN ras_Users c ON b.DIN=c.DIN) " & _
"LEFT JOIN ras_AttTypeItem d ON b.AttTypeId=d.I temId " & _
"WHERE b.DIN=c.DIN"
Set rsDataRAS = da_GetRs(QueryS elect)
QuerySelectSIKa wan = "SELECT * FROM " _
& "finger_data_ka ryawan"
Set rsSIKawan = da_GetRecord(Qu erySelectSIKawa n)
datetimeOut = rsSIKawan!TimeO ut >>> debug here
rsSIKawan.Close
rsSQL.CursorLoc ation = adUseClient
With rsSQL.Fields
.Append "idNo", adInteger
.Append "device", adInteger
.Append "idFinger", adInteger
.Append "nikKary", adVarChar, 50
.Append "namaKary", adVarChar, 100
.Append "time", adDate
.Append "tipeAbsen" , adVarChar, 64
End With
rsSQL.Open
If rsDataRAS.Recor dCount > 0 Then
jlhField = 0
While Not rsDataRAS.EOF Or rsDataRAS.BOF
rsSQL.AddNew
rsSQL("idNo").V alue = jlhField + 1
rsSQL("device") .Value = rsDataRAS("DN") .Value 'field device
rsSQL("idFinger ").Value = rsDataRAS("DIN" ).Value 'field finger ID
rsSQL("nikKary" ).Value = rsDataRAS("PIN" ).Value 'field nik karyawan
rsSQL("namaKary ").Value = rsDataRAS("User Name").Value 'field nama karyawan
rsSQL("time").V alue = rsDataRAS("Cloc k").Value 'field waktu
rsSQL("tipeAbse n").Value = rsDataRAS("Item Name").Value 'field tipe waktu
rsSQL.Update
rsDataRAS.MoveN ext
jlhField = jlhField + 1
If datetimeOut = "" _
Then
QueryUpdateSIKa wan = "UPDATE finger_data_kar yawan SET " _
& "TimeOut='" & Format(rsSQL("t ime").Value, "mm/dd/yyyy hh:nn:ss") & "'" _
& "WHERE Device='" & rsSQL("device") .Value & "' AND " _
& "idFinger=' " & rsSQL("idFInger ").Value & "' AND " _
& "NIKKary='" & rsSQL("nikKary" ).Value & "' AND " _
& "NamaKary=' " & rsSQL("namaKary ").Value & "' AND " _
& "TglHadir=' " & Format(rsSQL("t ime").Value, "mm/dd/yyyy") & "'" _
& "AND TimeIn='" & Format(rsSQL("t ime").Value, "" _
& "mm/dd/yyyy h:mm:ss") & "' AND TipeAbsen = " _
& "'" & rsSQL("idFInger ").Value & "'"
Call ExeQUERY(QueryU pdateSIKawan)
Else
QueryInsertSIKa wan = "INSERT INTO finger_data_kar yawan " _
& "(idNo, Device, idFinger, NIKKary, NamaKary, " _
& "TglHadir, TimeIn, TipeAbsen) " _
& "VALUES('" & rsSQL("idNo").V alue & "', '" & rsSQL("device") .Value & "', " _
& "'" & rsSQL("idFinger ").Value & "', '" & rsSQL("nikKary" ).Value & "', " _
& "'" & rsSQL("namaKary ").Value & "', " _
& "'" & Format(rsSQL("t ime").Value, "mm/dd/yyyy") & "', " _
& "'" & Format(rsSQL("t ime").Value, "mm/dd/yyyy h:mm:ss") & "', " _
& "'" & rsSQL("tipeAbse n").Value & "')"
Call ExeQUERY(QueryI nsertSIKawan)
End If
DoEvents
Wend
End If
Can anyone help me?
Regards,
Octo
QuerySelect = "SELECT a.DN, b.DIN, c.PIN, " & _
"c.UserName , b.Clock, d.ItemName " & _
"FROM ((ras_Device a INNER JOIN ras_AttRecord b ON a.DN=b.DN) " & _
"LEFT JOIN ras_Users c ON b.DIN=c.DIN) " & _
"LEFT JOIN ras_AttTypeItem d ON b.AttTypeId=d.I temId " & _
"WHERE b.DIN=c.DIN"
Set rsDataRAS = da_GetRs(QueryS elect)
QuerySelectSIKa wan = "SELECT * FROM " _
& "finger_data_ka ryawan"
Set rsSIKawan = da_GetRecord(Qu erySelectSIKawa n)
datetimeOut = rsSIKawan!TimeO ut >>> debug here
rsSIKawan.Close
rsSQL.CursorLoc ation = adUseClient
With rsSQL.Fields
.Append "idNo", adInteger
.Append "device", adInteger
.Append "idFinger", adInteger
.Append "nikKary", adVarChar, 50
.Append "namaKary", adVarChar, 100
.Append "time", adDate
.Append "tipeAbsen" , adVarChar, 64
End With
rsSQL.Open
If rsDataRAS.Recor dCount > 0 Then
jlhField = 0
While Not rsDataRAS.EOF Or rsDataRAS.BOF
rsSQL.AddNew
rsSQL("idNo").V alue = jlhField + 1
rsSQL("device") .Value = rsDataRAS("DN") .Value 'field device
rsSQL("idFinger ").Value = rsDataRAS("DIN" ).Value 'field finger ID
rsSQL("nikKary" ).Value = rsDataRAS("PIN" ).Value 'field nik karyawan
rsSQL("namaKary ").Value = rsDataRAS("User Name").Value 'field nama karyawan
rsSQL("time").V alue = rsDataRAS("Cloc k").Value 'field waktu
rsSQL("tipeAbse n").Value = rsDataRAS("Item Name").Value 'field tipe waktu
rsSQL.Update
rsDataRAS.MoveN ext
jlhField = jlhField + 1
If datetimeOut = "" _
Then
QueryUpdateSIKa wan = "UPDATE finger_data_kar yawan SET " _
& "TimeOut='" & Format(rsSQL("t ime").Value, "mm/dd/yyyy hh:nn:ss") & "'" _
& "WHERE Device='" & rsSQL("device") .Value & "' AND " _
& "idFinger=' " & rsSQL("idFInger ").Value & "' AND " _
& "NIKKary='" & rsSQL("nikKary" ).Value & "' AND " _
& "NamaKary=' " & rsSQL("namaKary ").Value & "' AND " _
& "TglHadir=' " & Format(rsSQL("t ime").Value, "mm/dd/yyyy") & "'" _
& "AND TimeIn='" & Format(rsSQL("t ime").Value, "" _
& "mm/dd/yyyy h:mm:ss") & "' AND TipeAbsen = " _
& "'" & rsSQL("idFInger ").Value & "'"
Call ExeQUERY(QueryU pdateSIKawan)
Else
QueryInsertSIKa wan = "INSERT INTO finger_data_kar yawan " _
& "(idNo, Device, idFinger, NIKKary, NamaKary, " _
& "TglHadir, TimeIn, TipeAbsen) " _
& "VALUES('" & rsSQL("idNo").V alue & "', '" & rsSQL("device") .Value & "', " _
& "'" & rsSQL("idFinger ").Value & "', '" & rsSQL("nikKary" ).Value & "', " _
& "'" & rsSQL("namaKary ").Value & "', " _
& "'" & Format(rsSQL("t ime").Value, "mm/dd/yyyy") & "', " _
& "'" & Format(rsSQL("t ime").Value, "mm/dd/yyyy h:mm:ss") & "', " _
& "'" & rsSQL("tipeAbse n").Value & "')"
Call ExeQUERY(QueryI nsertSIKawan)
End If
DoEvents
Wend
End If
Can anyone help me?
Regards,
Octo
Comment