I changed

From this:

rst.Filter "StudentNam ='temp'"

To this:

rst.Filter "StudentNam ='" & temp & "'"

and is still giving me an error(Invalid use of property) and it highlighted at the rst.Filter