For a better more permanent fix, try Counter Snap Kit. This screw fastening system secures loose hardwood floorboards and stops squeaks. You drive the slotted screw through a special bracket into the hardwood and subfloor. (For dense woods, you will need to drill a small pilot hole.) Once the screw tightens the loose board, you break off the screw just below the finished wood surface. You will be left with a very small hole which you can patch with wood putty or colored filler – or just ignore.
As for carpeted floor, you best choice is to re-nail the sub-floor, when replacing the carpet.
Amelia's Home Inspection offers the highest quality Home Inspection services in Greater Milwaukee, Wisconsin at an affordable price. A home inspection provides an analysis of potential fire hazards, home safety and health risks to your family.