A few possibilities but what stands out the most for me is that 'snum i" probably looks like an undefined property or function to Access.
Perhaps you mean snum & i or more likely, Mid(snum, i, 1)
Also, you don't have to declare snum in the procedure when you're passing the variable to the function anyway. Odd that you don't declare i though.
EDIT - another oddity is that you intend to loop, then make the function return only the result of the expression in the very last iteration of the loop. So if it loops 20 times, the function will only return the 20th value, so I don't see the point of that.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.