How we can attach the file to the right record

Hello dears, i need to attach the file to the right record, but when i select a record a select them all but when i hit the process button a certain files will attach to the records by there names, please can someone help me
here is my attachment code:

AttachmentHandler.DropNewAttachment(UD02Form, "C:\Users\" & otrans.session.userid & "\Desktop\Exported Files\" & filename & ".txt", edvUD02.dataview.table.rows(edvud02.row))

Can you give a little more detail?
I’m finding it hard to understand what the problem is from your original description.

In the meantime, have you already seen these topics?
https://www.epiusers.help/t/code-from-meug-presentation-on-5-20-2020-customization-tips-and-tricks/67376/22

Dear Mr or Ms bordway, sorry for the late reply, i made my own logic (code), thank for the reply, and yes i took some code from jose post, thank you very much have a nice day,

Regards, Ahmad Itani