[AccessD] Practical way to handle non-standard length "long text" fields
Ryan Wehler
wrwehler at gmail.com
Thu Mar 7 09:16:57 CST 2024
I like easy.... 😂😂😂
On Thu, Mar 7, 2024 at 9:09 AM John Colby <jwcolby at gmail.com> wrote:
> the easy way...😁
>
> On Thu, Mar 7, 2024 at 10:07 AM John Colby <jwcolby at gmail.com> wrote:
>
> > A simple class where you pass in the text box stored 'withevents' and the
> > max length? Then sink the key down and check how things are going.
> >
> > On Thu, Mar 7, 2024 at 9:31 AM Ryan Wehler <wrwehler at gmail.com> wrote:
> >
> >> John,
> >> I considered trying to 'class up' the textboxes. My idea would have
> been
> >> to have a local table with the form name, field name and maximum length
> >> and
> >> read that in as the class initializes for the textbox/combo box in
> >> question
> >> and use some events to catch the KeyDown or OnChange.
> >>
> >> Right now there's just a couple textboxes that are giving me grief so I
> >> wasn't sure if it was worth writing a class module at this point in
> time.
> >>
> >>
> >>
> >> On Thu, Mar 7, 2024 at 8:25 AM John Colby <jwcolby at gmail.com> wrote:
> >>
> >> > LOL one of my favorite sayings - "Wish in one hand and spit in the
> >> other.
> >> > See which one fills up faster."
> >> >
> >> > Given which fills up faster, of course I would suggest a class but we
> >> all
> >> > know where that would go. Something about hammers IIRC.
> >> >
> >> > Would you like me to build a class for you?
> >> >
> >> > On Thu, Mar 7, 2024 at 8:50 AM Ryan Wehler <wrwehler at gmail.com>
> wrote:
> >> >
> >> > > Thanks Rocky!
> >> > >
> >> > > I guess my wish was that Access read in the field length for fields
> >> like
> >> > > this and applied that more gracefully.
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > On Wed, Mar 6, 2024 at 3:00 PM Rocky Smolin <rockysmolin2 at gmail.com
> >
> >> > > wrote:
> >> > >
> >> > > > 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
> >> > > > >
> >> > > > --
> >> > > > AccessD mailing list
> >> > > > AccessD at databaseadvisors.com
> >> > > > https://databaseadvisors.com/mailman/listinfo/accessd
> >> > > > Website: http://www.databaseadvisors.com
> >> > > >
> >> > > --
> >> > > AccessD mailing list
> >> > > AccessD at databaseadvisors.com
> >> > > https://databaseadvisors.com/mailman/listinfo/accessd
> >> > > Website: http://www.databaseadvisors.com
> >> > >
> >> >
> >> >
> >> > --
> >> > John W. Colby
> >> > Colby Consulting
> >> > --
> >> > AccessD mailing list
> >> > AccessD at databaseadvisors.com
> >> > https://databaseadvisors.com/mailman/listinfo/accessd
> >> > Website: http://www.databaseadvisors.com
> >> >
> >> --
> >> AccessD mailing list
> >> AccessD at databaseadvisors.com
> >> https://databaseadvisors.com/mailman/listinfo/accessd
> >> Website: http://www.databaseadvisors.com
> >>
> >
> >
> > --
> > John W. Colby
> > Colby Consulting
> >
>
>
> --
> John W. Colby
> Colby Consulting
> --
> 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