I am not sure what you are trying to do but
say you have a form with a command button called command2
and a text box called TextboxwiththeName
You input a name on the textbox, then on click of the command button,
this will go through the records if there is a same name, and then it will display the name through a msgbox.
Private Sub Command2_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim currentnameonform As String
Dim sql As String
currentnameonform = Me.TextboxwiththeName
Set db = CurrentDb()
sql = "SELECT table2.name, table2.weight, table2.age, table2.height FROM table2 WHERE table2.name = '"
sql = sql & currentnameonform & "' AND table2.Active=-1"
MsgBox sql ' to check syntax
Set rst = db.OpenRecordset(sql)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do Until rst.EOF
MsgBox rst("name")
rst.MoveNext
Loop
Else
MsgBox "THere are no records"
End If
End Sub