sarayumi > 16-04-11, 05:23 PM
Noname > 16-04-11, 05:52 PM
Function checkuser() As Integer
On Error GoTo Err ' ne^'u user vào tru+.c tie^'p ba(`ng quye^`n guest thì cho level là 0
Dim rs1 As Recordset
Dim sql As String
sql = " select max(WGlevel) from tblWorkGroup where user= '" & username & "'"
Set rs1 = CurrentDb.OpenRecordset(sql)
rs1.MoveFirst
checkuser = rs1(0).Value
Exit Function
Err:
checkuser = 0
Exit Function
End Function
sarayumi > 16-04-11, 05:56 PM
Noname > 16-04-11, 06:20 PM
sql = " select max([level]) from T_group where user= '" & username & "'"
sarayumi > 16-04-11, 06:26 PM
sarayumi > 16-04-11, 10:59 PM
huynguyenbd > 31-10-11, 09:39 AM
Private Sub CmdThem_Click()
On Error GoTo Loi:
Dim Ma As String, ho As String, Ten As String, DC As String, DT As String, CQ As String, CN As String
Dim Bang As Recordset
Ma = Me.txtMaGV
ho = Me.TxtHL
Ten = Me.txtten
DC = Me.TxtDC
DT = Me.TxtDT
CQ = Me.TxtCQ
CN = Me.TxtCN
Set Bang = CurrentDb.OpenRecordset("select * from giaovien")
If Bang.EOF Then
GoTo Luu
End If
Bang.FindFirst ("magv = '" & Ma & "'")
If Not Bang.NoMatch Then
MsgBox "Gia tri " & Ma & " da co", vbInformation, "Thong Bao!"
Bang.Close
Exit Sub
End If
Luu:
If MsgBox("Ban co muon them thong tin nay khong?", vbQuestion + vbYesNo) = vbYes Then
Bang.AddNew
Bang!MaGV = Ma
Bang!HoLot = ho
Bang!TenGV = Ten
Bang!DiaChi = DC
Bang!DienThoai = DT
Bang!Coquan = CQ
Bang!ChuyenNganh = CN
Bang.Update
Else
Bang.Close
End If
Thoat:
Exit Sub
Loi:
Select Case Err:
Case 94
MsgBox "Ban vui long dien day du thong tin", vbInformation, "Thong bao"
Exit Sub
Case 3163
If Len(Ma) <> 4 Then
MsgBox "MaGV phai la chuoi co 4 ky tu", vbInformation, "Thong bao"
End If
Exit Sub
End Select
End Sub