Access the room below the squeaking floor, if possible. Look up at the ceiling to determine if the floor joists are open to view. If so, check to see if there are visible gaps between the subfloor and the joists -- beams that run across the ceiling to which the floor is attached.
Determine where the loose area is in relation to the flooring upstairs. Meaure over from an exterior wall or other easily identifiable structure. Transfer the measurements to the upstairs room to locate the squeaky section under the carpeting. Set a heavy weight on the floor or have a helper stand on it to force the floor down to the joist as much as possible.
Work from underneath the floor again, squirting a bead of construction adhesive between the joist and flooring to fill the gap on both sides of the joist. Drive either deck screws or 6d to 8d nails through the joist, at an angle, into the flooring above, a process called toenailing. Use a screw that is only as long as necessary to grip the wood floor above without penetrating the subflooring.
Ask your helper to move around, or do so yourself. If the squeak still sounds in the same area, the culprit is likely where two sheets of subflooring meet. Cut a 2-by-8 board to fit between the joists. Spread construction adhesive along the ends and the edge that will contact the floor above. Wedge into place under the seam and nail to the joists with 8d nails.
Walk around until you locate the approximate area that produces the squeak. Mark the location where the squeak begins and where it ends; the source likely lies in this area.
Tap on the floor with a hammer, listening for a dull, solid thud rather than a spongy, empty sound. This should locate your floor joist below the floor. Alternatively, use a stud finder or work with a known floor joist location, measuring over from an exterior wall, for example, every 16 inches (24 inches in some cases) to find the joists. While it is easier to find joists if you pull your carpet back, these methods should yield results.
Drill through the floor with a small-diameter bit to verify the presence of a stud. Work at a slight angle to ensure a better grip for the nail or screw you will install. You should feel resistance through the entire depth of the bit; if the bit suddenly feels like it's encountered empty air, you missed the stud, and should readjust your location slightly and drill again.
Insert either an 8d nail or a deck screw into the hole, poking it through the carpet so the head sinks below the surface. Drive through the floor, into the joist. Repeat with a couple more anchors near the same spot, again sinking into the joists, and in any other spots necessary. Countersink the nails or screws so that the heads are slightly beneath the subfloor to ensure they do not protrude above the carpet.