- Local time
- Today, 08:37
- Joined
- Sep 12, 2006
- Messages
- 16,069
michael - what exactly are you trying to do with this function - just confirm you have a integer?
in which case this (untested) ought to work. I think. I will test it now!
(tested and added an extra line)
note that an out of range integer will fail this test. I can't see that you can get round this. Access/VBA does not handle numbers too large to fit into a given variable type. Once you get above max longint, it is very tricky.
in which case this (untested) ought to work. I think. I will test it now!
(tested and added an extra line)
note that an out of range integer will fail this test. I can't see that you can get round this. Access/VBA does not handle numbers too large to fit into a given variable type. Once you get above max longint, it is very tricky.
Code:
function isint(v as variant) as boolean
dim i as integer 'or use long, if that is what you want
on error goto fail
i = v
isint = (i = v) 'just confirm that there was no rounding!
exit function
fail:
isint=false
end function
Last edited: