hi,please help.how come compare time between 2 table from ms.access database.This 2 table contain employeeno,date and Time.when get the compare time data will save to the overtime table comparetime field.
this is the current code:
please help.thanks.Code:Private Sub Command2_Click() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim rs1 As ADODB.Recordset Set cn = New ADODB.Connection cn.Open "Provider = 'Microsoft.Jet.OLEDB.4.0';" & "Data Source = " & App.Path & "\overtime.mdb;" Set rs = New ADODB.Recordset rs.Open "SELECT Time FROM Attendance ", cn, adOpenStatic, adLockOptimistic Set rs1 = New ADODB.Recordset rs1.Open "SELECT Time FROM Overtime", cn, adOpenStatic, adLockOptimistic t1 = Format(rs!Time, "hh:mm:ss") t2 = Format(rs1!Time, "hh:mm:ss") t3 = DateDiff("n", t1, t2) MsgBox " t3" End Sub




Reply With Quote