Inputbox

A

alvin Kuiper

Hi!
In excel i have Application.inputbox
how can i in acces be sure that my inputbox contains a Number
because if i cancel my inputbox i get an error

Thanks
 
B

Ben

how can i in acces be sure that my inputbox contains a Number
Have you tried the Isnumeric function?

Ben
 
J

Jim Burke in Novi

I'm assuming you have a numeric variable and you're setting it equal to the
InputBox result, like:

myNum = InputBox(...)

The problem with this is that if they cancel or enter anything non-numeric
it will generate an error. There may be better ways of doing this, but what I
do is declare a String variable and then check the value of it, e,g,

dim strNum as String
dim myNum as Integer (or whatever type you need it to be)

strNum = InputBox(whatever you have here)
if not isnumeric(mynum) then
do what you want to do here if it's not numeric ...
else
myNum = CInt(strNum) change this to the appropraite conversion
function
end if

Someone else may have a better way, but something like that should work for
you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top