I am so sorry your dog is feeling bad like that. Is it arthritis? Or does he have a disk problem? Has there been a diagnosis?
Tramadol is a pretty strong painkiller and is a narcotic. I am surprised it hasn't relieved his pain. One side effect of narcotic painkillers can be constipation.
However it sounds more as if he is unable to get into position to do his business properly.
Do you have anyone who can help you to get him into the car without causing him more discomfort? If I were you I would just call on a neighbour to help you -if there is someone nearby. Most neighbours won't mind helping for a few minutes like that in an emergency situation. You may even find they are very compassionate.
If that is impossible or you live in a remote place, then you will have to arrange for the vet to make a house call. That will take longer, as they may only be able to come outside surgery hours, so you may have to wait a few hours. There will also be a call-out fee of course.
Your poor dog, Bless him and I hope he can be relieved of his pain. I would think X rays at least of his spine and hips are in order, and a good pain relief plan. It may be that a drug combination will help (such as pain relief coupled with muscle relaxants) I don't know. See what the vet advises.
My kindest thoughts, and hope he will be okay.