ongke0711 > 18-04-16, 03:42 PM
Dim rs As DAO.Recordset, strSQL As String
strSQL = "SELECT Nhaphoso.SoQD, Nhaphoso.NgayKetqua, Nhaphoso.Nguoicocong, Nhaphoso.Nguoihuonghangthang, Nhaphoso.Nguoihuongmotlan, Nhaphoso.Xa, Nhaphoso.Huyen, Nhaphoso.LoaiHS, Nhaphoso.Doituong, Nhaphoso.NguoiGQ, Nhaphoso.Ngaynhan, Nhaphoso.GhichuKQ " & _
"FROM Nhaphoso " & _
"WHERE Nhaphoso.SoQD Is Not Null AND Nhaphoso.Doituong = '" & [Forms]![frmlocloaihoso]![cbolocdoituongtg] & "' AND Nhaphoso.Ngaynhan BETWEEN #" & [Forms]![frmlocloaihoso]![txtngaydau] & "# And #" & [Forms]![frmlocloaihoso]![txtngaysau] & "#"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount > 0 Then
rs.MoveFirst
Else
Exit Sub
End If
With rs
Do Until .EOF
.Edit
!GhichuKQ = !GhichuKQ & "-" & Me.txtngaydau
.Update
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
Dim rs As DAO.Recordset, qdf As QueryDef, prm As Parameter
Set qdf = CurrentDb.QueryDefs("qrybaocaotheothoigian")
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next
Set rs = qdf.OpenRecordset(dbOpenDynaset)
If rs.RecordCount > 0 Then
rs.MoveFirst
Else
Exit Sub
End If
With rs
Do Until .EOF
.Edit
!GhichuKQ = !GhichuKQ & "-" & Me.txtngaydau
.Update
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing