Thank you for your question and welcome to Just Answer.
Bactrim is primarily used for urinary tract infections which are caused by bacteria significantly different than the type typically infect teeth. As a rule bactrim is ineffective against tooth abscesses. You need to take an antibiotic in the Penecillin (Amoxicillin) family of Erythromycin (Clindamycin) family of antibiotics in order to help with your abscess.
Call your dentist's office and he should be able to call in a prescription for you.
I hope this answers your question. If you would like to discuss this further or have any additional questions, please reply to my answer and I will get right back to you.
Sincerely, XXXXX XXXXX DDS