The saying is “If All You Have Is a Hammer, Everything Looks Like a Nail!”. Several people made it famous. However the meaning should be quite clear. Basically you should always have the right tool for the job at hand.
I use this saying quite often as it paints a cartoon in my head of someone pounding a screw as if it were a nail! Why I have even seen that done. Yes it was me who was doing the pounding. Though it seemed like a good idea at the time I wound up with a huge hole in my wall made of sheet rock!
We do this because we are just too lazy to get the proper tool. With a few bangs of the hammer we cause damage and then regret the rather large hole created. Just a bit of forethought and the effort to retrieve a screwdriver designed for the screw could have turned that slop job disaster into a task well done. But the hammer in hand influences us to strike things and bang on things and blinds us to any alternative. So we in turn must make an effort. Put the hammer down and having only a screw, think “if I had a screwdriver…”. Then we must realize it is worth the effort to find it, borrow one or even purchase it!
Only when you have a nail should you ever think “If I had a Hammer”.