One of the joys of working with Duncan


I’ve talked before about our InfoPath form associated with a SharePoint (WSS) library that we use for status reporting (). I use a ‘week of’ field and custom views for grouping status reports for a specific week. The date needs to be set to the same date for all status reports for that week, otherwise the grouping doesn’t work. For example, we use Friday, so the right date for this week’s status report is Feb. 13. There’s a reminder in the form about setting it to Friday, and it’s documented in our process, but invariably there are one or two status reports every week that aren’t set to Friday. In this case, I have to either send to nag mails asking the person(s) to change the report, or change it/them myself. Tiresome at best. Obviously I needed to add script validation on the field, but it’s pretty low on the list of changes that I want to make to the system, largely because I’d have to dig to figure out the script (remember, I’m not a developer, I’m an “Information Worker“ 😉 and that’s probably not the best use of my time at this point.


Last night, though, I decided to ask Duncan and Kent if they’d be willing to help with a validation script for the date field. I fully expected one of them to be willing to help me, since they’re both already shown an amazing willingness to help me solve problems in the past. I sent mail to them at 11:24pm, and figured I’d follow up in person in the next couple of days. Much to my surprise, when I came in this morning I found an email from Duncan, sent at 12:52am, providing me with not only the script I needed to include, but also an example InfoPath form showing the use of it! Woo Hoo, Duncan rocks!


(And if you’re wondering, Kent also responded that he would write it; Duncan just beat him to it.)


Here’s the VB code that Duncan provided (which I added to the OnBeforeChange Event for the datepicker field):

On Error Resume Next
eventObj.ReturnStatus = True
If Not eventObj.IsUndoRedo Then
If Not IsEmpty(eventObj.NewValue) Then
If Not Weekday(eventObj.NewValue) = 6 Then
eventObj.ReturnMessage = “Date selected must be a Friday”
eventObj.ReturnStatus = False
End If
End If
End If

I’ve implemented the code in the status report form (more about that in the next post), and it works like a champ! I’m so looking forward to not having to deal with the wrong date in status reports this week, or ever again!

Comments (4)

  1. http://www.kamun.com/

    http://movie.kamun.com/

    http://www.kamun.com/sitemap/index.htm?id=movie

    http://www.kamun.com/sitemap/movie01.htm?id=movie

    http://www.kamun.com/sitemap/movie02.htm?id=movie

    http://www.kamun.com/sitemap/movie03.htm?id=movie

    http://www.kamun.com/sitemap/movie04.htm?id=movie

    http://www.kamun.com/sitemap/movie05.htm?id=movie

    http://www.kamun.com/sitemap/movie06.htm?id=movie

    http://www.kamun.com/sitemap/movie07.htm?id=movie

    http://www.kamun.com/sitemap/movie08.htm?id=movie

    http://www.kamun.com/sitemap/movie09.htm?id=movie

    http://www.kamun.com/sitemap/movie10.htm?id=movie

    http://www.kamun.com/sitemap/movie11.htm?id=movie

    http://www.kamun.com/sitemap/movie12.htm?id=movie

    http://www.kamun.com/sitemap/movie13.htm?id=movie

    http://www.kamun.com/sitemap/movie14.htm?id=movie

    http://www.kamun.com/sitemap/movie15.htm?id=movie

    http://www.kamun.com/sitemap/movie16.htm?id=movie

    http://www.kamun.com/sitemap/movie17.htm?id=movie

    http://www.kamun.com/sitemap/movie18.htm?id=movie

    http://www.kamun.com/sitemap/movie19.htm?id=movie

    http://www.kamun.com/sitemap/movie20.htm?id=movie

    http://www.kamun.com/sitemap/movie21.htm?id=movie

  2. moviedown:http://www.kamun.com/

    moviedown:http://movie.kamun.com/

    moviedown:http://www.kamun.com/sitemap/index.htm

    moviedown:http://www.kamun.com/sitemap/movie01.htm

    moviedown:http://www.kamun.com/sitemap/movie02.htm

    moviedown:http://www.kamun.com/sitemap/movie03.htm

    moviedown:http://www.kamun.com/sitemap/movie04.htm

    moviedown:http://www.kamun.com/sitemap/movie05.htm

    moviedown:http://www.kamun.com/sitemap/movie06.htm

    moviedown:http://www.kamun.com/sitemap/movie07.htm

    moviedown:http://www.kamun.com/sitemap/movie08.htm

    moviedown:http://www.kamun.com/sitemap/movie09.htm

    moviedown:http://www.kamun.com/sitemap/movie10.htm

    moviedown:http://www.kamun.com/sitemap/movie11.htm

    moviedown:http://www.kamun.com/sitemap/movie12.htm

    moviedown:http://www.kamun.com/sitemap/movie13.htm

    moviedown:http://www.kamun.com/sitemap/movie14.htm

    moviedown:http://www.kamun.com/sitemap/movie15.htm

    moviedown:http://www.kamun.com/sitemap/movie16.htm

    moviedown:http://www.kamun.com/sitemap/movie17.htm

    moviedown:http://www.kamun.com/sitemap/movie18.htm

    moviedown:http://www.kamun.com/sitemap/movie19.htm

    moviedown:http://www.kamun.com/sitemap/movie20.htm

    moviedown:http://www.kamun.com/sitemap/movie21.htm