i used the below code as per you
Sub test()
Dim cdb As DAO.Database, rstMain As DAO.Recordset, rstAttach As DAO.Recordset2, _
fldAttach As DAO.Field2
Set cdb = CurrentDb
Set rstMain = cdb.OpenRecordset("SELECT PPLink, Attachment FROM EmployeeDetails", dbOpenDynaset)
Do Until rstMain.EOF...