Thanks nukkumatti.
I tried the approach you suggested but I couldn't get it to work. It's very possible that it's because I am not knowledgable enough with coding. I also tried several other approaches that I read online on various sites, and I couldn't get any of them to work either. However, I found an approach in the InfoPath 2003 SDK ...