over time the molding around the door frame has pulled out a little and we always just use a hammer and block of wood to put it back into place, but recently my door was slammed and now it's completely pulled away from the wall. Not sure if theirs anything I can do about this. iv got power tools but no knowledge on what to do.
Long (3") screws (3 or 4) through the jamb into the framing of the house should do it. Be careful not to drive them too tight; otherwise you'll warp the jamb and the door will fit loosely. In a perfect world, you'd predrill the jamb with a drill bit big enough that the screw goes through it readily (but not too loose). If you have the same problem on the hinge side, replace one screw per hinge with a long one. Same caution about overtightening applies (and it would be worse on this side if you did it wrong).