If (IsNull(Text1.Text) Or Text1.Text = "" Or IsNull(Text2.Text) Or Text2.Text = "") Then
MsgBox "Invalid data"
Else
Set rs = New ADODB.Recordset
i = 0
rs.Open "select Username from Usr_Pwd where Username= '" & Text1.Text & "'", CON, adOpenForwardOnly,
adLockReadOnly, adCmdText //////////////// This Query is working now//////////////////////
While (rs.EOF = False)
rs.MoveFirst
If rs.Fields(0) = Text1.Text Then
MsgBox "username already exists"
i = 1
If (i = 1) Then
Exit Sub
End If
Else
rs.MoveNext
End If
Wend
If (i = 0) Then
CON.Execute mstrSQL
End If
End If