Troubleshooting
Aircraft Equipment Problem Less Severe; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Clearance
Flight Crew Landed in Emergency Condition; General Maintenance Action
Aircraft
The First Officer was flying on the leg from ZZZ. On the climbout from ZZZ; PTRIM main inop and PTRIM backup inop warnings illuminated. We continued the climb; finished the After Takeoff Checklist and then ran the QRH. The QRH led us to the cutouts for both trims. When we selected the backup trim the warning disappeared and I quickly tried to trim down but it stopped and the warning illuminated again. I finished the QRH; which suggested to consider nearest suitable airport. We discussed continuing to [destination] and continued our climb. We reached level off altitude and as the airspeed increased it became apparent that continuing at normal speed to [destination] would be a difficult task. The First Officer then pulled the power back to help alleviate some of the pressure. As I was trying to formulate a plan and decide our next step; I noticed the First Officer having trouble holding altitude level; I advised the First Officer we were high; he started the correction. At this time; we considered airports nearby and ZZZ1 was directly in front of us. I [told] ATC that we had a control malfunction and were correcting altitude. We [advised ATC] and got direct ZZZ1. I decided to swap controls to give the First Officer a break and because I wanted to be able to feel the control inputs. At our altitude; it seemed ZZZ1 would make a good choice and give us time to run checklists. The timing worked out well and we landed safely at ZZZ1 with no further issues. PTRIM main and PTRIM backup warning messages; plus the inability to control pitch trim.
Air carrier Captain reported pitch trim failure with limited controllability.