Ciao a tutti, premetto che non ne capisco tanto di vba... ma mi serve risolvere un problema.
Ho creato un database in access e ora devo fare alcune maschere. Il problema sta nel creare una maschera di login. Il codice è questo:
codice:
Private Sub Interruttore4_Click()
Dim DB As Database
Dim SQLStatement1 As String
Dim SQLStatement2 As String
Dim rst1 As Recordset
Dim rst2 As Recordset
If ((IsNull(Testo0.Value) = False) And (IsNull(Testo2.Value) = False)) Then
Set DB = CurrentDb
SQLStatement1 = "SELECT * " & _
"FROM Amministratore " & _
"WHERE codive = '" & Testo0.Value & "';"
Set rst1 = DB.OpenRecordset(SQLStatement1)
If (rst1.RecordCount = 0) Then
MsgBox ("Utente inesistente!")
Else
SQLStatement2 = "SELECT password " & _
"FROM Amministratore " & _
"WHERE codice = '" & Testo0.Value & "';"
Set rst2 = DB.OpenRecordset(SQLStatement2)
If (rst2.Fields!Password = Testo2.Value) Then
DoCmd.Close acForm, "Login"
MsgBox ("Accesso effettuato.")
Else
Testo2.Value = ""
MsgBox ("Password errata!")
End If
rst2.Close
End If
rst1.Close
Set DB = Nothing
Else
MsgBox ("Inserire username e password!")
End If
End Sub
quando premo sul pulsante mi da l'errore:
codice:
Errore di compilazione:
Previsto tipo definito dall'utente enon progetto
Quando mi da l'errore evidenzia la scritta in verde nel codice
Qualcuno sa aiutarmi?