Sto tentando di connettermi tramite MS Access e VBA al DB locale Sql server e sono un po' confuso
Ma ricevo errore di
codice:
run-timer 3709 Connessione chiusa o non valida in questo contesto. Impossibile utilizzarla per eseguire l'operazione.
Codice PHP:
Function cerca() As String Dim cn As ADODB.Connection
Dim rs As Recordset
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT * FROM dbo.tblUtenti WHERE ((((StrComp([dbo.tblUtenti.Nome_Utente],'" & Forms!Autorizzazione!nome_utente & "',0))=0))AND((StrComp([dbo.tblUtenti.Password],'" & Forms!Autorizzazione!Password & "',0))=0))"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open "Driver={SQL Server};Server=DESKTOP-0ICL8QI;Database=Biblico;Trusted_Connection=Yes;" End With If Not rs.BOF Then cerca = rs!tipo
Else
MsgBox "Nome Utente o password errati" & vbCrLf & "Attenzione alle maiuscole e minuscole", vbExclamation, "Autorizzazione"
Forms!Autorizzazione.nome_utente.Value = ""
Forms!Autorizzazione.Password.Value = ""
Forms!Autorizzazione.nome_utente.SetFocus
cerca = False End IfEnd Function