I have a text box on a form that only allows numbers like 40799. If I enter the string 00040799 and look at the VB code the value for this text box shows as 40799. How do I modify the text box so that it will accecpt the string 00040799 and will not truncate it to 40799 when I look at the value for the text box in the code. Thanks for the help.
1 - change the field data type in the underlying table to string data type, instead of long integer or whatever numeric data type is there now. You can always demand the text box input be numeric ("00040799" is a numeric input, as there are no non-numeric characters in it) by using the input mask property in the text box's property sheet.
2 - in your vba, don't use the VAL() function to access the text box's contents. That will only give you the numeric value, which is, indeed, 40799. I assume you don't have to display it, only save it and/or compare it. If you're comparing it, you can use the comparison operators (=,<,>,<>) to do the necessary work.