1

vb.netを使用して、パスワードが同じかどうか(大文字に関しても)を確認しようとしています。しかし、ライン

 result = String.Compare(actPassword,userPassword)

エラー「コンパイルエラー: 予想される:(」を出し続ける

Private Sub Login_Click()
    'Check to see if data is entered into the UserName combo box
     If IsNull(Me.cmbLoginID) Or Me.cmbLoginID = "" Then
        MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
        Me.cmbLoginID.SetFocus
       Exit Sub
      End If
      'Check to see if data is entered into the password box
       If IsNull(Me.txtPW) Or Me.txtPW = "" Then
           MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
            Me.txtPW.SetFocus
        Exit Sub
        End If
      'Check value of password in tblEmployees to see if this matches value chosen in combo box
      Dim userPassword As String
      Dim actPassword As String
      Dim result As Integer
      userPassword = txtPW.Text
      actPassword = DLookup("EmpPassword", "Employee", "EmployeeID='" + Me.cmbLoginID.Value + "'")
      result = String.Compare(actPassword,userPassword)
      If result = -1 Then
        'Close logon form and open splash screen
            DoCmd.Close acForm, "Login", acSaveNo
            DoCmd.OpenForm "HomePage"
         Else
        MsgBox "Password Invalid. Please Try Again", vbCritical + vbOKOnly, "Invalid Entry!"
         Me.txtPW.SetFocus
        End If
     'If User Enters incorrect password 3 times database will shutdown
        intLogonAttempts = intLogonAttempts + 1
        If intLogonAttempts > 3 Then
          MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
        Application.Quit
       End If

    End Sub
4

3 に答える 3