Note added 23 July 2006: I mean "allergic" in a lay person's sense, as in "very bad reaction to" - I'm not a medical expert and I don't claim to be one so don't hold me to the standards of a medico! I'm editing this post to make it quite clear what I mean.)
Believe me, the best time to find that out is as soon as you can, before you might need it - not when you've had to be administered a dose of morphine or codeine as a painkiller after an operation or serious injury. Constant throwing up night and day due to a bad reaction to morphine really isn't conducive to a speedy recovery. Or indeed to killing pain.
"Allergies" to drugs are not nice at all. What's an easy (and legal, of course!) way to find out if you have a morphine or codeine "allergy"?
First, ask your parents/grandparents if they're "allergic" i.e. have had a bad reaction to morphine or codeine or other morphine derivatives. This kind of bad reaction is often hereditary. If your mother says she gets nauseous even at the thought of morphine, that's a bit of a clue that you might not do too well on it yourself.
Second, if you've ever taken anything with codeine in it, listen to what your body says about it. Solpadeine is a drug you can buy over the counter without a doctor's prescription, in England at least. I've found that, for me anyway, Solpadeine is extremely effective for headaches and period pains (aside to any squeamish lads or indeed ladettes reading this - yes, I said "period pains". Too bad, menstruation is perfectly natural and not something to be discussed only in hushed tones, just think of this as my own small contribution towards the much needed desensitisation of society [/aside]).
Anyway. Solpadeine. I take it when I need it from time to time, but I can't manage more than one capsule (which is enough to sort out the pain for me), and I can't take the dissolving (and therefore more quickly absorbed) variety either - it makes me feel sick. I really, really should have learned something from that. If Solpadeine makes you feel ill, especially when you take the soluble type or take more than one capsule, you may be "allergic" to codeine or morphine and you should consult a medical professional to check!
My excuse is that I didn't know codeine was a morphine derivative when I was prescribed a heavy duty codeine preparation for a serious condition recently (plus when you're in a bad way the last thing you may think of is to check whether the particular painkiller on offer is going to make you vomit - you just want any painkiller, NOW!!!).
[Added 28 December 2005:] I never dreamt anyone would be stupid enough to read the previous few paragraphs as meaning that I was actually advising people to try taking Solpadeine or some other codeine derivative in order to test whether they're "allergic" to codeine, fer goodness' sake. I never suggested anything of the kind, and I certainly don't suggest it. I just meant that IF you had ever taken it in the past and didn't react well to it, then you should definitely go to a medical professional and get it checked out. I did NOT mean that you should check it out by experimenting on yourself, no one could possibly mean that, as anyone with more than a couple of brain cells to rub together would know! But given the recent comment, I felt I had to add this paragraph. I hope all is crystal clear now. Honestly, some people...
Alternative painkillers[Added 18 June, as I notice quite a few hits for this post]:There are other painkiller medications available, especially combined with tablets that reduce the acidity in your stomach so you're less likely to throw up after taking them. Not so effective at dealing with the pain caused by certain conditions, perhaps, but better than exacerbating your condition through constant spewing (the interruption to sleep from frequent desperate grabs for the sickbucket won't exactly help speed up recovery either).
Obviously you should consult your medical adviser, but mine gave me a painkiller called Motifene or diclofenac sodium, plus a "stomach liner" (lots of names, I've seen Zoton and Lansoprazole) which I took first thing in the morning before taking the painkiller - and they worked great for me.
So: have you got a codeine/morphine "allergy"? - check it out when you can, and find out what alternative analgesics are available for you, or you may be sorry when you need a serious painkiller.