Thanks @Wayne G. Dunny for his helpful discussion with me. This helps me figure out the problem of my current implementation and a possible solution to it.
Here is the reason for the #ERROR shown in my unbound text box, text_root_cause_field. This text box is bound to a function call in my subform's Load Event with two other fields from my subform's record source as parameters. This will initially give me a value in text_root_cause_field text box because the record source of my subform has been set in the form property to be one of my queries, Shipment_cycle_time.
This works fine until the program hits my main form's Open Event. In the Open Event, I set the subform's record source to be NULL because I do not want to display any data on the form's startup. As the main form's Open Event happens after the subform's Load Event, I do not have any field present in the subform any more. So the function which my text_root_cause_field is bound to is retrieving values from two non-existent fields. This gives the #ERROR.
The solution is pretty simple after the cause is figured out. I can include the SQL output of my function to the SQL of my subform's record source. So the subform's record source becomes like
SELECT s.*, (SELECT TOP 1 root_cause FROM Shipment_Remark as r
WHERE r.plant = s.plant
AND r.shipment_no = s.shipment_no
ORDER BY r.update_time DESC) as root_cause
FROM shipment_cycle_time AS s WHERE TRUE
In addition to all the fields in shipment_cycle_time query, the other field root_cause is selected from a different table based on the two shipment_cycle_time fields. This is exactly the same as what returns from the function. Instead of using a function, I set the controlsource of the text box text_root_cause_field to root_cause field.
Problem solved!