Public Function MyFunction() As Integer or As Dataset if blah then return dataset else return 1 'integer value of some kind end if End Function