A hard inquiry on your credit file stays for two years, but the lender's decision to deny your loan is not recorded.