You need to create your link to the document by using the standard A tag.
Then add your dynamic code to the A tag to reference the dynamically created file name.
e.g.
<a href="/CaseDocuments/<?php echo $row_recordset['filename1']; ?>" target="_blank"><?php echo $row_recordset['filename1']; ?></a>
Cheers
Ian