Nausea and vomiting are frequent adverse effects of patient-controlled analgesia with opioids. This study was designed to compare the effect of midazolam to that of ondansetron for prevention of nausea and vomiting during morphine patient-controlled analgesia. In a randomised, double-blind, prospective trial, 90 patients were allocated to one of three groups of 30 each, to receive one of three patient-controlled analgesia regimens to manage postoperative pain: a combination of midazolam and morphine (group M), a mixture of ondansetron and morphine (group O) or morphine alone (group C). Patients were assessed for the incidence of nausea and vomiting, the degree of sedation (awake, mild, moderate, deep) and other side-effects during the first 24 hours after the operation. The frequency of nausea and vomiting was significantly lower in groups M (27%) and O (37%) compared with group C (70%) (P < 0.05). The incidence of mild sedation in group M was significantly higher than that in groups O or C (P < 0.05). We conclude that midazolam is as effective as ondansetron in preventing opioid-induced nausea and vomiting following total abdominal hysterectomy and has acceptable side-effects.