I placed all of the code in one module behind a form. I split it up into a couple procedures. There is a textbox control that is bound to a field in a table. This is there to ensure there is a record in the table and so the VBA code knows what record/row to place the file attachment to.
It seems you got the file picker working by changing the a little, the code you copied. I copied the original version and placed the file picker code behind one control button's click event. I also put the strPath declaration at the top of the module in the general section. This way the other procedure and function know what the value is.
What needed to be added is another procedure. I added this code behind a second control button. I split it up so you can start to see what is going on. This button opens the DAO recordset and then calls the function to do the Attach thing. After the function is called, the code in the second control continues. This second control and its code in the click event is the crucial part. Without this, and a couple other little tweaks, your DB is not going to function.
You will have to look at the DAO and learn about DAO in general. I believe the example here is darn close to what you are tyring to accomplish. You have a form. The form is bound to a table/query. The current record of the form is where you want the user to attach a file of the User's choice. This is what the sample DB does.