Password

D

Dan @BCBS

Ok, I've spent too many days on something and it's time to ask for help.

Do you have any basic reference for creating and updating a password.

From one table (t_User) I have the persons ID and password.
On the Login form I a combo box for ID and unbound text for password.

This is the most current attempt I have, it's roots are from a Microsoft book.
It bombs in the COMMAND BUTTON code at: PWT.cpw Me.cmbRACF, Me.txtPW

"COMMAND BUTTON (cmdLetMeIn)
Option Compare Database

Private Sub cmdLetMeIn_Click()
Dim PWT As New m_LoginCode


PWT.cpw Me.cmbRACF, Me.txtPW

End Sub

MODULE (m_LoginCode)
Sub cpw(empid As Long, pw As String)
Dim cmd1 As Command
Dim strSQL As String
Dim prm1 As ADODB.Parameter
Dim rst1 As ADODB.Recordset

'Assign the command reference and connection.
Set cmd1 = New ADODB.Command
cmd1.ActiveConnection = CurrentProject.Connection

'Write out SQL statement with parameters & assign to cmd1.
strSQL = "Parameters Secret Long;" & _
"Select RACFID, Password from t_Users " & _
"Where RACFID =Secret"
cmd1.CommandText = strSQL
cmd1.CommandType = adCmdText


Set prm1 = cmd1.CreateParameter("Secret", adInteger, adParamInput)
prm1.Value = empid
cmd1.Parameters.Append prm1

'A handy line for catching SQL syntax errors.
' Debug.Print cmd1.CommandText

cmd1.Execute

Set rst1 = New ADODB.Recordset
rst1.Open cmd1
If rst1.Fields("Password") = pw Then
MsgBox "Welcome.", vbInformation, _
"Programming Microsoft Access 2000"
Else
MsgBox "Invalid password. Try again or " & _
"change password.", vbCritical, _
"Programming Microsoft Access 2000"
End If

End Sub


Sub NewPW(eid As Long, NuPassword As String)
Dim cmd1 As Command
Dim strSQL As String

'Assign the command reference and connection.
Set cmd1 = New ADODB.Command
cmd1.ActiveConnection = CurrentProject.Connection

'Define the SQL string; notice
'the insertion of passed arguments.
strSQL = "UPDATE t_Users " & _
"SET RACFID.Password = """ & NuPassword & """ " & _
"WHERE RACFID=" & eid & ";"
Debug.Print strSQL

'Assign the SQL string to the command and run it.
cmd1.CommandText = strSQL
cmd1.CommandType = adCmdText
cmd1.Execute

'Confirmation message
MsgBox "Your new password is accepted. " & _
"Return to Employee Authentication or " & _
"Exit this form.", vbInformation, _
"Programming Microsoft Access 2000"

End Sub


thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top