Ideally, code would not be copied into multiple locations. If you want a procedure to be used by multiple objects, then it must be placed in a general module for that to be possible.



Otherwise, copy/paste code to each form and modify as appropriate for that form's references. If the forms are identical in structure with same controls and names, then nothing would have to be changed. But why would there be multiple identical forms?

Your original code references a control path via a subform reference. So exactly where is this procedure located - on main form? Main form does not have the control for ComplaintNumber so by removing the subform path, code errors because it cannot find ComplaintNumber.