Hi Phillip,
If possible, it is best to have zero code in your solution. This cuts down on maintenance costs later. To do this you can move functionality to a web service tier or do it with declartive logic in the form.
If you must add code to the form the best way is with Visual Studio 2005 (VS2003 will work but it doesn't have nearly as good Intellisense and syntax highlighting) and a managed code language. Currently the only managed code lanugages that are available for use with InfoPath are VB.NET and C#.NET. Everyone at Qdabra Software uses C#.NET and this is my personal favorite. I also think that Microsoft has declared it as the best practice language for InfoPath development, but don't quote me on that.
If you need some help getting started with Visual Studio there are sevearl posts on the forums about getting this started, but let us know if you hit a roadblock. Good luck!
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge