If you want to check that user exists or not and you use
Button1_Click()
event, try this:
Private Sub Button1_Click(...)
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
On Error Goto Err_Handler
Set cnn = New ADODB.Connection()
cnn.CursorLocation = adUseClient
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb" & ";Persist Security Info=False;"
cnn.Open
Set rs = New ADODB.Recordset()
rs.Open "Select * From tbluser Where uname = '" & txtuser.Text & "'", cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount <> 1 Then
Msgbox "Users count: " & rs.RecordCount, vbQuestion, "How is this possible?"
Goto Exit_Sub
End If
MsgBox "Welcome!" & vbCr & "Herzlich Willkomen!" & vbCr & "Witaj!", vbInformation, "Message..."
Exit_Sub:
On Error Resume Next
rs.Close
cnn.Close
Set rs = Nothing
set cnn = Nothing
Exit Sub
Err_Handler:
Msgbox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Sub
End Sub