Thứ Ba

Tạo Form Đăng Ký Trong access vba

Private Sub buttoin_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("acount")
Dim dem As Integer
dem = 0
Do While rs.EOF = False
If rs!user = txtuser.Value Then
dem = 1
Exit Do
Exit Do
End If
rs.MoveNext
Loop
If dem = 1 Then
MsgBox "Ten nay da ton tai"
Exit Sub
End If
rs.AddNew
rs.Fields("user") = txtuser.Value
rs.Fields("pass") = txtpass.Value
rs.Fields("Ten") = txtten.Value
rs.Fields("Ho") = txtho.Value
rs.Fields("Email") = txtemail.Value
rs.Fields("SoDT") = txtsdt.Value
On Error Resume Next
rs.Update
MsgBox "Ban Da Dang Ky Thanh Cong", vbOKOnly, "Thong Bao!"
DoCmd.Close
End Sub

0 nhận xét:

Đăng nhận xét

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates