access vba - How do i protect string in text box? -


i have problem text box named "txtprice". want protect text box string. if input 1 string show message wrote. if input, example "12r", doesn't anything.

dim integer dim s long = asc(txtprice) if < 48 or i> 57    'ascii number      msgbox "error" end if 

what looking for? under properties can specify input mask.

you can try if not isnumeric(txtprice) if you're looking number.

if don't want letters, try this:

dim intpos integer  intpos = 1 len(txtprice)     select case asc(mid(txtprice, intpos, 1))         case 65 90, 97 122             isletter = true         case else             isletter = false     end select     if isletter exit next intpos  if isletter     msgbox "error" end if 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -