You assign the value being returned to the variable Patient_name, but that's all you're doing. I don't understand this
Hospital_code in field Patient_name
You want to put the hospital name in the control that's meant for the patient name?
If you can figure it out, you need to make the applicable control to be the result of the lookup, but I can't figure out what that is, and it may not work if that field is bound. Try editing it manually first. It may be as simple as Me.yourControlName = DLookup....
Is there a possibility that the lookup returns no value? Then you need to handle Null as well.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.