Password

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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



.



Relevant Pages

  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)
  • Re: Is there a way to prevent a RichTextBox from scrolling?
    ... Private _isRegex As Boolean ... Public Sub New(ByVal thispattern As String, ... Dim entry As tDict ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Excel Listing tool using VB
    ... Sub ListFiles2() ... Dim directories() As String, CurrentDirectory As String ... Dim dirtopaste, dirok ...
    (microsoft.public.vb.general.discussion)
  • Form Error
    ... SMSDS_CallerID As String ... Private Declare Sub Sleep Lib "kernel32" ... Dim ComString As String ... Dim AppPath As String, FreeFileNo% ...
    (microsoft.public.vb.bugs)
  • Tool to get MCP ODT at Windows CMD prompt
    ... You basically send a series of ODT commands of your choosing, once, or in a loop, and get the output right in the command ... Dim sHostname ... Sub WriteIt ... WriteIt "" ...
    (comp.sys.unisys)