Hello,
Welcome to Infopathdev Forums
There is a HowTo on this site which will help you to do this.
Please read the link below
http://www.infopathdev.com/howto/tutorials/default.aspx?i=7bc880f391b84ea9b3b45c6fbecc07c6
I hope this will help you.
Kalyan G Reddy
Infopath MVP 2007 and 2008