Xuân Thanh > 18-06-13, 09:33 PM
Private Sub cmdTimKiem_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblSanPhamTam", dbOpenTable
If rs.RecordCount > 0 Then
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From tblSanPhamTam"
DoCmd.SetWarnings True
End If
If Not IsNull(Me.txt1) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "Insert InTo tblSanPhamTam Select * From tblSanPham Where MaSP = '" & Me.txt1 & "'"
DoCmd.SetWarnings True
End If
If Not IsNull(Me.txt2) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "Insert InTo tblSanPhamTam Select * From tblSanPham Where MaSP = '" & Me.txt2 & "'"
DoCmd.SetWarnings True
End If
...........
Me.lstSanPham.RowSource = "tblSanPhamTam"
End Sub