Use the AfterUpdate event of both your From and To boxes to lookup the
distance in the table and assign it to the field on your form.
This kind of thing:
Private Sub LocationFrom_AfterUpdate()
Dim strWhere As String
If Not (IsNull(Me.[LocationFrom]) or IsNull(Me.[LocationTo])) Then
strWhere = "([LocationFrom] = """ & Me.[LocationFrom]) & _
""") AND (LocationTo = """ & Me.[LocationTo]) & """)"
Me.[Distance] = DLookup("Distance", "Distances", strWhere)
End If
End Sub
Private Sub LocationTo_AfterUpdate()
Call LocationFrom_AfterUpdate
End Sub
Notes:
=====
1. Adjust the code to match your actual field names. Note that "FROM" is a
reserved word in SQL, so not a good name for a field. I've therefore
suggested LocationFrom and LocationTo as field names.
2. If the LocationFrom and LocationTo field are Number fields (not Text
fields), lose the extra quotes, i.e.:
strWhere = "([LocationFrom] = " & Me.[LocationFrom]) & _
") AND (LocationTo = " & Me.[LocationTo]) & ")"
3. Calling the one procedure from the other is easier to write and maintain
that duplicating the code.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
>I have a form (Mileage) that tracks my mileage using two fields (From and
> To). I have a table (Distances) that lists the mileage between all
[quoted text clipped - 11 lines]
> am
> working in ACCESS 2003