View Single Post
  #5 (permalink)  
Old June 12th, 2003, 10:02 AM
Kenny Alligood Kenny Alligood is offline
Authorized User
Join Date: Jun 2003
Location: , FL, USA.
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts

quote:Originally posted by SerranoG
quote:Originally posted by Kenny Alligood
 I am attempting to cancel a keystroke thru code and am not having any luck. I have a textbox on a form that I want to limit to 30 characters. I have the field in the underlying table set to a max of 30 but I want to warn the user that the maxinum has been exceeded (at 31 characters) and activate the backspace key (KeyAscii(8)).
 I don't understand why you need to code this. If the field is limited to 30 characters then when the user tries to type the 31st character, Access will just not type it. The user then knows that the limit has been reached. Because the 31st character will not be even allowed to be typed, there is no need to activate a backspace. Doing so will erase the 30th character. You don't want that.

Unless I misunderstand your intention it sounds like you're creating more work for yourself. Let Access function by default in this case.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
The reason that I wanted to include code was that Access does indeed limit the fields maximum property but it does not let the user know that it is limited. I tested that to be certain but that is the case. When I entered more than 30 characters the textbox processed the text up to the 30th character and removed the rest - never letting the user know this. If the user has no way to see the underlying table (which mine do not) then they would never know that a portion of their data was deleted due to size limitations. With the code I can include a MsgBox and backspace key to alert the user accordingly. Nevertheless, I do appreciate your reply it gave me the opportunity to test something that I wasn't certain about to begin with. As such, I have always wanted to include code to control my environment as opposed to depending on the application.

Kenny Alligood
Reply With Quote