Results 1 to 14 of 14

Thread: [RESOLVED] Check If Name Exists In MS Access

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Location
    Nairobi
    Posts
    75

    Resolved [RESOLVED] Check If Name Exists In MS Access

    I know this might be something very simple but it has gotten me scratching my head for some minutes. I want to check if the user entered UserName already exists in MS Access, if it does, the given is rejected.

    Here is what I have:

    Code:
     
    If DTR("UserName") <> TxtUserName.Text.ToString Then
       'If Username is available, save the information to the database
       MyQry = "INSERT INTO UsersTable(UserName,FullName,UserPassword) VALUES('" & TxtUserName.Text "','" & TxtFullName.Text & "','" & TxtConfirmPassword.Text & "')"
       MyCmd = New OleDbCommand(MyQry, Conn)
       With MyCmd
          .ExecuteNonQuery()
       End With
    Close()
    Else
       MsgBox(Prompt:="The provided UserName is not availble. Plese choose another one.", Buttons:=MsgBoxStyle.Exclamation, Title:="UserNameError")
    End If
    Last edited by bentumkoitaba; Mar 27th, 2019 at 03:57 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width