Let's assume you want to find [Your_Value] in MatchingField_Name and wish to return ReturnField_Name. You would set the text box Control Source to:
=GetFieldValue([Your_Value],"MatchingField_Name","ReturnField_Name")
Notice that [Your_Value] comes from the current bound table for the form which has a field named "Your_Value". Also notice I'm passing two field names in quotes without the [] because I'm passing the field name itself and not it's value.
Next, place this code in the form's code mod:
Code:
Private Function GetFieldValue(sPassed As String, sSource As String, sTarget As String)
'Retreives first instance in DB of sTarget field where sPassed is value matching sSource in table
Dim rsTable As Recordset
Set rsTable = CurrentDb.OpenRecordset("Select * From Table1 Where " & sSource & " = """ _
& sPassed & """")
If rsTable.RecordCount > 0 _
Then GetFieldValue = rsTable(sTarget).Value _
Else GetFieldValue = ""
rsTable.Close
End Function
You didn't give any field names or table names so I am using 'Table1' as the lookup table name.
Hope this helps point in the right direction.