Hi,
I am new to VB6, in fact I'm trying to teach myself how to use it.
Here is my problem. I am trying to code a login screen. The screen has one input field along with a login button and a cancel button.
I want to verify the password with the password stored in the Password table in access. There is only one field in the table(Password) and there will only ever be 1 record. Also I would like to have the password appear in asteriks as the user is typing it in.
Here is what I've got so far:
Dim dbCon As ADODB.Connection
Dim dbCom As ADODB.Command
Dim commandString As String
Private Sub btnCancel_Click()
frmLogin.Hide
frmMainMenu.Show
End Sub
Private Sub btnLogin_Click()
Dim passwd As String
Set dbCon = New ADODB.Connection
Set dbCon = New ADODB.Connection
Set dbCom = New ADODB.Command
On Error GoTo ErrorHandler
dbCon.Open (dbConnectionModule.GetConnectionString)
Set dbCom.ActiveConnection = dbCon
Set rsPassword = Server.dbCon("ADODB.Recordset")
rsPassword.Open "Select Password From Password"
passwd = rsPassword("Password")
If txtPassword.Text <> passwd Then
MsgBox "Please enter a valid password"
Else
dbCom.Execute
dbCon.Close
frmLogin.Hide
frmManagementTools.Show
End If
Exit Sub
ErrorHandler:
MsgBox Err.Description
If dbCon.State = adStateOpen Then 'Check the open state of the connection
dbCon.Close 'If it is open then close it
End If
End Sub
Any suggestions will be greatly appreciate,
Thanks in advance!!