Quote:
> I can't remember how to make sure a user can't input a letter into a
number
> field like zip code. Please help me. I'm a VB wannabe.
> Thanks
Using the IsNumeric function is probably the easiest way, though it's
not necessarily the most elegant. You could, for instance, put it in
the Validate event of a text box:
Private Sub txtZIP_Validate(Cancel As Boolean)
If IsNumeric(txtZip.Validate) = False then
MsgBox "Enter a number, stupid!"
txtZIP.text = ""
End If
End Sub
One thing to be aware of in cases like Zip codes and Social Security
numbers, though: You'll need to account for things like dashes in a
ZIP+4 number. IsNumeric("90210") returns True, but
IsNumeric("90210-0101") returns False.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---