ADO In Access How to Create Log In Form


Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection


ADO In Access How to Create Log In Form ====================================================== Option Compare Database Dim rs As New ADODB.Recordset Dim cn As New ADODB.Connection Dim sql As String Private Sub txtPassword_AfterUpdate() If cn.State = adStateOpen Then cn.Close Set cn = CurrentProject.AccessConnection sql = "select * from tbUser Where Username= '" & txtUserName.Value & "' And Password= '" & txtPassword.Value & _ "' order by ID" If rs.State = adStateOpen Then rs.Close With rs .CursorLocation = adUseClient .CursorType = adOpenDynamic .LockType = adLockOptimistic .Open sql, cn, , , adCmdText End With If Not rs.EOF Then MsgBox " User Login is " & txtUserName.Value Else MsgBox "Try Again" End If End Sub

Comments

Popular posts from this blog

Export Access Object to Excel ,PDF, RTF , etc. using DoCmd.OutputTo

HOW TO OPEN ACCESS IN FULL SCREEN: OPENING A FORM AS MAXIMIZED ?

DoCmd.OutputTo in xlsx (Excel 2007+) Format