Hello everybody:
I want to create a code that searchs in a Random Access file. I tried with this code:
------------------------------------------------
Private Sub Command1_Click()
Dim tempName As String

tempName = InputBox("Entre el Nombre:")
For recordNum = 1 To LOF(1)
Get #1, recordNum, Human
If (Human.name = tempName) Then
Label1.Caption = Human.name
Label2.Caption = Human.phone
Else
MsgBox ("Name not found in file.")
End If
Next recordNum
End Sub
-------------------------------------------------
It compiles, but when I check the values of Human.name and tempName are different. For example. If I enter in the input box this string "Luis E. Cuadrado" when I check the value of Human.name it only has "Luis". This is the type definition in a *.BAS module:
-------------------------------------------------
Type Person
name As String * 50
phone As String * 13
End Type
-------------------------------------------------
and this is the declaration of the record in the declaration section:
-------------------------------------------------
Dim Human As Person
Dim recordNum As Integer
-------------------------------------------------
and this is the Open Statement:
-------------------------------------------------
Private Sub Form_Load()
Open "friends.txt" For Random As #1 Len = Len(Human)
recordNum = 0
End Sub
-------------------------------------------------
Is there any other better way to make a search in a Random Access file? Any anser is welcome. I hope to hear from you soon. Have a nice day.

Best regards
Luis