Hello to all, I am always mad about this problem. If I type a name with two words in a textbox like "google corporation" it will be registered in the database ms access as "Google Corporation" now that is okay. What I want is, there should be no duplicate of names, but the problem is, when I enter "google corporation" it will be registered again in the database instead of displaying "No duplicate". This is my code:
Private Sub Command1_Click()
Dim rst As New ADODB.Recordset
Dim i As Integer
Dim R_Count As Currency
With rst
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "SELECT * FROM records"
End With
If rst.AbsolutePosition > -1 Then
rst.MoveLast
R_Count = rst.RecordCount
rst.MoveFirst
For i = 1 To R_Count
If rst.Fields("name") = Trim$(Text9.Text) Then
MsgBox "No Duplicate", vbCritical, "Duplicate Name"
Text1.SetFocus
Exit Sub
End If
rst.MoveNext
Next i
Call saveData
Else
Call saveData
End If
End Sub
This code only work like this:
TextBox: Database:
Google Corporation---->Google Corporation = OK
google Corporation---->Google Corporation = Not Working
Google corporation---->Google Corporation = Not Working
google corporation---->Google Corporation = Not Working
As you can see, the code only work if what you enter in the textbox is equal to the database. Is there a way where I can convert "google corporation or google Corporation or Google corporation" to "Google Corporation"?