Thank you, Olaf. I am just learning this stuff, and got that code either from an example somewhere, or cobbled it together from several examples (which may explain why things aren't consistent).

Anyway, you got me on the right path. I got it working, but still had to make a few changes. I had to change the function to return a Double instead of Integer, and had to say GetPersonId = pl(i, 1).Value in the for loop, since I kept getting overflow errors. But after that, it works!

Thanks again!