Here's a warning.
I have had a number of cases where the client was positive on a urinalysis for a medication that had been prescribed. The issue then becomes whether the prescription period had expired. The Air Force in particular has been hard on these cases.
You have an injury, you get prescribed a pain medication, you have surplus pills. Weeks or months later, the pain returns and you take one of the pills from the original prescription and don't have to go through the hassle of visiting the doctor. This could create a legal problem--especially in the Air Force because of an appeals decision in United States v. Mull, from the Air Force Court of Criminal Appeals. The facts of the case are somewhat different from my example above.
At several points over the course of the charged time frame, I was given a prescription for diazepam from my medical provider to help treat pain I experienced due to the herniated disc in my back. During this same time frame, I was also using heroin on a regular basis; and my tolerance from heroin was increasing. To augment the sedative effect of the heroin I was injecting intravenously, I would take diazepam even when I did not have any back pain in an effort to augment my heroin use and also to help control my withdrawals from heroin. I knew that this was wrong because it wasn’t the reason I was prescribed diazepam.
Keep in mind Mull was pleading guilty. He admits, essentially that the use was "recreational" and not related to his injury. Even so, the AF court takes a broad swipe against anyone using a prescribed medication outside the time the doctor prescribed. See also, United States v. Pariso, 65 M.J. 722 (A.F. Ct. Crim. App. 2007).
The bottom line for Air Force members is to destroy any leftover pills once the exact prescribed use is finished, and if you have a new or recurring problem--report to medical for examination and new prescription if needed.