I believe you have fallen victim to event bubbling. There are a couple of options here, but what is happening is that the OnValidate event is being called for several nodes through a hierachy. Instead of using e.Source, I suggest using e.Site, and on top of that you should probably put a limiting check on there to make sure you don't get that error:
Dim ppString As String
ppString = e.Site.nodeValue.ToString()
if( ppString.Length < 12 ) 'Make sure that the string is long enough
return;
Dim ppStart As String
Dim ppEnd As String
Dim ppYear As String
Dim ppMonth As String
Dim ppDay As String
Dim ppDateString As String
MessageBox.Show("Date=" + ppString, "Timesheet", MessageBoxButtons.OK)
ppYear = ppString.Substring(0, 4)
(Sorry about the syntax on the code I edited, I don't really do VB)
For more information about event bubbling, see this link:
http://www.infopathdev.com/howto/tutorials/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge