huanmonster > 05-07-17, 10:26 AM
Option Compare Database
Option Explicit
Const conJetDate = "\#mm\/dd\/yyyy\#"
'
Private Sub cmdCapNhat_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim rndTime As Date
strSQL = "SELECT CheckInOut.* FROM CheckInOut " & _
"WHERE CheckInOut.TimeDate BETWEEN " & Format(Me.txtTuNgay, conJetDate) & " AND " & Format(Me.txtDenNgay, conJetDate) & " AND timevalue(CheckInOut.[TimeStr])>= #" & Me.txtTimeFilter & "#" And Day(CheckInOut.timedate) Mod 2 = 1
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Do Until rs.EOF
rs.Edit
rndTime = (Me.txtEndTime - Me.txtStartTime) * Rnd() + Me.txtStartTime
rs!TimeStr = rs!timedate + rndTime
rs.Update
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
tranthanhan1962 > 05-07-17, 12:47 PM
huanmonster > 05-07-17, 01:20 PM
ongke0711 > 05-07-17, 01:32 PM