Xuân Thanh > 17-04-19, 10:29 AM
Option Compare Database
Option Explicit
Dim rs As DAO.Recordset, Dem As Integer
Private Sub cboUserID_Click()
If rs.RecordCount > 0 Then rs.MoveFirst
rs.Move Me.cboUserID.ListIndex
Me.txtTen = rs.Fields(1)
strID = rs.Fields(0)
End Sub
Private Sub cboUserID_Enter()
SendKeys "%{DOWN}"
End Sub
Private Sub cmdDangNhap_Click()
If rs.RecordCount > 0 Then rs.MoveFirst
rs.Move Me.cboUserID.ListIndex
If Me.txtPas = rs.Fields(2) Then
Forms!frmMeNu!DanhMuc.Enabled = True
Forms!frmMeNu!NhapLieu.Enabled = True
Forms!frmMeNu!BaoCao.Enabled = True
Forms!frmMeNu!QuanTri.Enabled = True
Forms!frmMeNu!Help.Enabled = True
Forms!frmMeNu!QuanLyKhoSub!cmdDangNhap.Enabled = False
DoCmd.Close
Else
MsgBox "Sai Password", vbCritical, "Quan Ly Kho"
Me.txtPas.SetFocus
Dem = Dem + 1
End If
If Dem = 3 Then DoCmd.Quit
End Sub
Private Sub cmdThoat_Click()
DoCmd.Close
End Sub
Private Sub Form_Load()
Set rs = CurrentDb.OpenRecordset("tblNhanVien", dbOpenTable)
Me.cboUserID.RowSourceType = "Value List"
AddUser
End Sub
Private Sub AddUser()
If rs.RecordCount > 0 Then rs.MoveFirst
Do Until rs.EOF
Me.cboUserID.AddItem rs.Fields(0)
rs.MoveNext
Loop
End Sub
Public strID As String