Dim cnn As New ADODB.Connection
Dim tablo As New ADODB.Recordset

Private Sub Command1_Click()
On Error GoTo hata
With tablo
tablo.Open "Select * from giris where k_adi='" & Text1.Text & "' and sifre='" & Text2.Text & "'", cnn, adOpenDynamic, adLockOptimistic
If tablo.EOF Then
MsgBox "Kullanıcıadı veya Parola yanlış Program Kapatılacak Lütfen Tekrar Deneyin", 0 + vbCritical, "Uyarı"
cnn.Close
Unload Me
Else
cnn.Close
Unload Me
End If
End With
hata:
End Sub

Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.ConnectionString = "musteri.mdb"
cnn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cnn.CursorLocation = adUseClient
cnn.Open