Albany Molecular Research (NASDAQ:AMRI) disclosed a new deal yesterday that could lead to recurring revenue in future years. Investors reacted enthusiastically, sending the stock up 4.5%. Unfortunately, the good news is outweighed by another development that threatens to hit the firm's revenue hard. Despite the new agreement, Albany Molecular still has its near-term work cut out for it.

The company disclosed that Bristol Myers-Squibb (NYSE:BMY) has acquired an exclusive license for Albany Molecular compounds known as biogenic amine reuptake inhibitors, which are being explored as possible treatments for depression and other central nervous system disorders.

The deal seems like a good one. Bristol Myers is paying $8 million up front and will fund Albany Molecular's future research into the compounds to the tune of $10 million. The pot gets sweeter if the medications advance in development. Albany Molecular would receive $66 million per drug for the first two compounds and $22 million for every additional compound, in addition to royalties on sales if any drugs are commercialized.

As an added bonus, Albany Molecular's chemistry services business may benefit from the pact. Bristol Myers agreed in the pact to hire Albany Molecular for additional chemistry services, including manufacturing, if the drug giant outsources in those areas. After a difficult 2004, Albany Molecular's contract service business has bounced back this year. Adding Bristol Myers as a client would only help that momentum.

Notably, Albany Molecular is not new to the licensing game. The company owns the rights to the active ingredients in the allergy drug Allegra, licensed by Sanofi-Aventis (NYSE:SNY). The arrangement has been lucrative for Albany Molecular. For the first six months of 2005, Allegra royalties were up 17% year over year to $27.9 million, constituting almost 28% of the firm's revenue.

However, the Allegra cash cow is now threatened. Barr Pharmaceuticals (NYSE:BRL) and TevaPharmaceutical (NASDAQ:TEVA) have launched a generic version of Allegra. Not surprisingly, Sanofi and Albany Molecular have filed an injunction to prevent the generic version's marketing. The legal strategy may work in the near term, but it seems likely that Allegra will soon face generic competition. As a result, Allegra's sales and Albany Molecular's royalties will surely sink.

Albany Molecular's contract services side is improving, and Allegra royalties won't disappear. Even so, the company seems to be facing some tough times ahead.

For more on Albany Molecular:

The Motley Fool has kicked off its ninth annual Foolanthropy campaign! Nominate your favorite charities on our Foolanthropy discussion board through Nov. 1. For guidelines on what makes a charity Foolish, visit .

Fool contributor Brian Gorman is a freelance writer in Chicago. He does not own shares of any companies mentioned in this article.