Has this ever happened to you? It's the middle of the night and your son is sick and needing to see a doctor. Urgent care is no longer open and that means it's time for a trip to your local hospital's emergency department. So you bundle up your entire family and load everyone into the car.

You arrive at the hospital and after a doctor examines your child, an antibiotic is prescribed. The last thing you want to do is make another stop at the pharmacy, but what choice do you have? Well, technology has helped St. Mary's Hospital offer patients a new option.

We have a new system called InstyMeds, says St. Mary's Hospital emergency physician, Dr. Kyle Martin. It's essentially a prescription vending machine. But instead of a candy bar or soda, it gives you the medication you need.

It's not a full pharmacy, but it does have almost 100 different types of medications which equates to about 80 percent of the medications that are typically prescribed in an emergency room setting.

Our InstyMeds vending machine has most of the pain medications we need, along with nausea medications and antibiotics, says Dr. Martin. Additionally, it has a couple of different strengths of some medications along with adult and pediatric formulations, too.

How does it work? Patients treated by a physician who also need medications are given the option of receiving a written prescription or using the InstyMeds machine. If the patient chooses the InstyMeds option, the physician enters the order into a computer. The computer prints a receipt with a special code. The patient then takes that printout to the InstyMeds machine, types in the unique code, pays the insurance copay and within a few minutes receives the prescription. The insurance information provided by the patient when he/she arrives at the emergency room prompts the computer to notify the insurance company. Then when the patient visits the machine, he pays the same copay he would have if he visited a local pharmacy.

The convenience factor is the biggest advantage of having this option, says Dr. Martin. If you are a family with children who have ear infections, it's nice not to have to make a special stop on the way home to go to the pharmacy. And for patients without transportation it can be a godsend.

For some patients, insurance coverage is an issue. Additionally, unexpected prescriptions may not be something the patient can afford. For these types of situations, St. Mary's provides a special code to patients allowing them to receive their medications without charge. Dr. Martin says St. Mary's has provided $11,000 worth of prescription medications free of charge to un- or under-insured patients since the machine arrived in late 2007.

Dr. Martin has seen many patients who've been thankful for the InstyMeds option. I saw an elderly gentleman recently at 11:30 p.m. or midnight. He was here with his wife and had fallen and needed a pain medicine stronger than Tylenol or ibuprofen. He couldn't drive at night and when I told him he could get his prescription filled here, he was really excited about that.

The vending machine dispenses enough of a medication to get most people through the course of their treatment. But anyone requiring a refill will need to visit their local pharmacy.

It doesn't have medications you'd take on an on-going basis, he says. It's really designed for those times of day â€" after hours for instance â€" where it's difficult to get to a pharmacy or days when there's a foot of snow and getting to the pharmacy would be difficult.

And with the winter we've been having more people are choosing this option. Since the InstyMeds machine was installed at St. Mary's in late 2007, it's been used about 400 times a month. That's more than 4,000 prescriptions filled this way in 2008 alone! And Dr. Martin expects more people to choose this route in the future.

Once more people realize how easy the machine is to use, I think we're going to see the number of people choosing this option increase, says Dr. Martin. It saves time. You can start your course of medication sooner and medications are the same price or cheaper with this machine than at a local drug store.

All these factors add up to a much better experience for the patient. That makes Dr. Martin smile because it's exactly the reason this vending machine was installed in the first place.

One of my colleagues, Dr. O'Brien, had seen this machine at a hospital in Minnesota, says Dr. Martin. It came up in a conversation we were having about ways we could make the emergency department visit - which is always unplanned and generally the worst day someone is having - a little less painful. After looking into it, we decided it would be a great fit.