tvn_hut > 06-07-13, 07:20 PM
paulsteigel > 06-07-13, 09:14 PM
Private Sub CmdSearch_Click()
Dim rst As New ADODB.Recordset
Dim strSql As String
'rst.Open "SubNV", Staffcode, adOpenDynamic, adLockBatchOptimistic
'vbookmark = rst.Bookmark
' Ban can chu y la doi tuong Staffcode phai duoc khoi tao, day la ket noi du lieu cua thu tuc
' Ban co the bonhwng doan toi da comment
If FraSearch.Value = 1 Then
If nz(TextMaNV, "") = "" Then
' nen thay IsNull(TextMaNV) bang nz(), day la ham kha hay cua Access
MsgBox "Ma nhan vien khong the de tronh...", vbInformation + vbOKOnly, "Can't find"
Exit Sub
End If
strSql = "Select * from SubNV where Staffcode ='" & TextMaNV & "'"
'rst.Find "Staffcode ='" & TextMaNV & "'", , , adBookmarkFirst
rst.Open strSql, Staffcode, adOpenDynamic, adLockBatchOptimistic
'hoac thay bang doan nay
'rst.Open strsql, currentproject.Connection, adOpenDynamic, adLockBatchOptimistic
If rst.EOF Then
MsgBox "Khong co ma nhan vien nao nhu vay"
'rst.Bookmark = vbookmark
Else
MsgBox "Da tim thay [" & rst.RecordCount & "] nhan vien.."
End If
rst.Close
End If
Set rst = Nothing
End Sub