You're passing a recordset to the sub but then you're re-defining the recordset by using strsql.
then you're setting the recordset "rst" to strsql but without the dbopendynaset argument
set rst = currentdb,openrecordset(strsql, dbopendynaset) or whichever type of recordset you wish.
if you just...