Dim conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Application.StartupPath & "\DBase.accdb;")
conn.Open()
Dim Str As String
Str = "SELECT * FROM DB WHERE [Username] = '" & UsernameTextBox.Text & "'"
Dim cmmd = New OleDbCommand(Str, conn)
Dim dr As OleDbDataReader
dr = cmmd.ExecuteReader()
If Not dr.HasRows Then
MsgBox("Username available.")
Else
MsgBox("Username already taken. Try another.")
End If