Barham was first elected as a Democrat in a special election for an unexpired state Senate term held on November 8, 1994, a heavily Republican election year nationally. He defeated then fellow Democrat Johnny Dollar, 13,932 votes to 10,765. He was reelected with 93 percent of the vote in the fall of 1995 for a full four-year term and was unopposed in 1999. Thereafter, he switched parties and ran in 2002 as a Republican for the vacant Fifth District U.S. House seat. He was unopposed again for the state Senate in 2003. Barham was term-limited and was ineligible to have sought reelection to the Senate in 2007.