It's the first time I use the Network Analyst Tool (Closest Facility) in ArcGIS (version Desktop 10.6.1) and I ve just faced this kind of issue.
I have two point shapefiles (for example, the "Hospital Buildings Layer" and a "Street Numbers Layer"), then I have a Network Dataset made by junctions and lines (that are my crossroads and streets).
I would like to know, for each street number, which is the closest Hospital Building, so I use the Network Analyst Tool - Closest Facility and it works.
This is the issue: each street number point is projected to the nearest street the tool finds, but I would like to improve this. Each street number point should be projected to the street it belongs to (and not to the nearest one). So, I need a tool that look inside the attribute table of the street number layer and look for the attribute field that represents the code of the street which the street number belongs to. At the same time, the "streets Layer" has a code which is the key to get this link between streets and points and allow the projection I need.
I hope everything is clear.