Praise be to Allah, the Lord of the World; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Imam Abu Nua'em narrated from Anas (Radiya Allahu Anhu) that the Prophet (Sallallahu Alaihi wa Sallam) said: "Everyone who acts according to what he has learned, Allah will grant him the knowledge of that which he does not know".
This Hadith is weak as confirmed by Imam Showkani in his book 'al-Fwaaid-al Majmooha Fi al-Ahadith al-mawdooah'.
Anyway, though the Hadith is weak but its meaning is true for many verses and Hadith that present the same meaning.
Allah Says (interpretation of meaning): {O you who believe [in Mûsa (Moses) (i.e. Jews) and 'Iesa (Jesus) (i.e. Christians)]! Fear Allâh, and believe too in His Messenger (Muhammad SAW), He will give you a double portion of His Mercy, and He will give you a light by which you shall walk (straight), and He will forgive you. And Allâh is Oft-Forgiving, Most Merciful.}[57:28].
The "light" mentioned in the above verse refers to the useful knowledge which enables one to distinguish between truth and falsehood and between guidance and aberrance. Allah Says (interpretation of meaning): {O you who believe! If you obey and fear Allâh, He will grant you Furqân a criterion [(to judge between right and wrong), or (Makhraj, i.e. making a way for you to get out from every difficulty)], and will expiate for you your sins, and forgive you, and Allâh is the Owner of the Great Bounty.}[8:29]
Allah also Says (interpretation of meaning): {…but if they had done what they were told, it would have been better for them, and would have strengthened their (Faith); And indeed We should then have bestowed upon them a great reward from Ourselves. And indeed We should have guided them to a Straight Way.}[4:66-68].
There is much evidence proving that if one acts according to one's knowledge (of Qur'an and Sunnah) Allah will open for him the doors of knowledge he does not know as a blessing for his adhering to the Sharia. The purpose of the knowledge is to act according to it; otherwise, the one who knows and does not act in accordance to his knowledge is worse than the one who acts without knowledge.
Allah knows best.