nell'arkivio ho trovato questo, ciao
codice:
Private Sub cmdOk_Click()
Dim db_file As String
Dim statement As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
' Open the database.
db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "data.mdb"
' Open a connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
conn.Open
' Look up the user name/password.
statement = "SELECT COUNT (*) FROM Users WHERE " & _
"UserName='" & Replace(txtUserName.Text, "'", "''") & "' AND "
& _
"Password='" & Replace(txtPassword.Text, "'", "''") & "'"
Set rs = conn.Execute(statement)
' See if we got anything.
If CLng(rs.Fields(0)) < 1 Then
' There is no match.
' Do not allow the login.
Unload Me
MsgBox "Invalid user name/password."
Else
' There is a match.
' Display the program's main form.
Form1.Show
Unload Me
End If
rs.Close
conn.Close
End Sub