quan_pc > 02-02-15, 10:37 AM
Trích dẫn:Tạo đăng ký tài khoản:
tadmin(user,pass,hoten,cauhoibimat,traloi)
các textbox cần có: txtten, txtpass, txthoten,txtbimat,txttraloi,
Nút lệnh: Tạo tài khoản "tao", nút lệnh đóng "dong"
-----
Private Sub tao_Click()
Dim DB As DAO.Database
Dim rs As DAO.Recordset
Set DB = CurrentDb
Set rs = DB.OpenRecordset("tadmin")
rs.MoveFirst
Do While (rs.EOF = False)
If (rs.Fields("user") = txtten.Value) Then
MsgBox "Ten dang ky da co"
Exit Sub
End If
rs.MoveNext
Loop
rs.AddNew
If (txtpass.Value = txtpass2.Value) Then
rs.Fields("user") = txtten.Value
rs.Fields("pass") = txtpass.Value
rs.Fields("hoten") = txthoten.Value
rs.Fields("cauhoibimat") = txtbimat.Value
rs.Fields("traloi") = txttraloi.Value
rs.Update
rs.Close
DB.Close
MsgBox "Da dang ky thanh cong!"
Else
MsgBox "xac nhan pass khong trung!"
End If
End Sub