[AccessD] Practical way to handle non-standard length "long text" fields
Rocky Smolin
rockysmolin2 at gmail.com
Wed Mar 6 15:00:16 CST 2024
Ryan:
I don't know of a good way to handle this. I have used KeyDown to good
advantage when I wanted to inspect every keystroke in a text field. But
it's a little kludgey.
Two ideas: I believe if you use the input mask property to allow a textbox
to take a maximum number of characters. It will not allow any more
characters than that input mask allows. So at 500 characters no more input
would be accepted. But that won't generate a message to the user. And I
don't know if you can input mask a text box to limit to that high of a
number of characters.
A second thought would be to accept the data into an unbound text box and
in the Lost Focus event, test for the length of the string that was input -
copy it to the bound text box if shorter than your Max length, or give a
message to the user that their entered text was too long and then shift the
focus back to the unbound text box.
HTH
r
On Wed, Mar 6, 2024 at 7:01 AM Ryan Wehler <wrwehler at gmail.com> wrote:
> Is there any practical way to handle non-standard VARCHAR(MAX) "long text"
> fields in access?
>
> If I set one to VARCHAR(500), Access still treats it as Long Text(MAX) and
> the user doesn't really know it's going to be a problem until they exit the
> field and an error pops up.
>
> Ideally what I'd like is for access to just stop typing as it it would if
> you hit the char limit for the field. Is there a way to do that without
> using OnChange or KeyDown events to count characters up and warn the user?
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list