Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting Length of a Textbox (XP)

    Does Access have an equivalent to Excel's MaxLength property for a textbox in a form? I can't seem to find anything that fits the bill. All help is appreciated!!!

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Length of a Textbox (XP)

    If the textbox is bound to a field in a table, then it's length is set by the field. Unbound texboxes don't limit the entry. You can impose an input mask to restrict the number of characters. For example, an Input mask of ">LL" is often used when you want to enter a State abbreviation. The > forces capital letters, and the LL restricts entry to letters.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Length of a Textbox (XP)

    I wondered if I would have to go through the binding routine. I'll have to refresh my memory on that. The only other solution I could think of was to compare the length of the textbox entry to the length of the output field (which is messy and doesn't make sense if the textbox can be bound).

    Thanks for the response.

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Length of a Textbox (XP)

    Using Bound forms is definitely easier. Some people don't like to use Bound forms, claiming they get better control over a form by doing it all themselves. Quite frankly, I see no advantage to do this and prefer to use Bound forms when possible. Why spend time working on procedures that Access already handles quite well? A case in point is your question on limiting the entry into a textbox. (I'm sure this statement will provoke some responses!) If I have a textbox that is bound to a field called City that is 25 characters long, why should I have to jump thru hoops to make sure the user can't enter more than 25 characters when Access handles it for me?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting Length of a Textbox (XP)

    The main reasons for unbound forms are speed in loading forms, reduction of network traffic, and reducing user collisions in saves. If you aren't experienced in using them or if you aren't working with tens of thousands of records behind a form, then most forms can be bound without any problems. There are other reasons, of course, such as a situation where each control on a form creates or is populated by a separate record, rather than a field in a single record. There are those who prefer to use an intermediate table and jump through the hoops of populating it or updating actual records from it so they can use bound forms. I personally don't see the point in that. It's really a matter of preference. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Length of a Textbox (XP)

    As I said, I prefer to use bound forms when possible, I should have added "and when reasonable". I certainly won't jump thru hoops jump to make my form bound.

    Binding a form to a table with tens of thousands of records is indeed foolish, and I don't do that. I do, however, still use a bound form! I simply use a recordsource that returns only a single record based on the primarykey for the table. Access can find and return this record very quickly. I don't see how manually doing this would be any faster, unless you were opening your tables directly in the backend rather than using the linked table from the frontend. And even then, I'd suspect the difference might not be noticable.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting Length of a Textbox (XP)

    You don't have to persuade me, Mark. I use the same technique on bound forms. But there are still instances where unbound forms are the most practical approach.
    Charlotte

  8. #8
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Length of a Textbox (XP)

    >>But there are still instances where unbound forms are the most practical approach.<<

    Oh absolutely! I was talking in generality in my initial response to Steve. And while I unashamedly prefer bound forms, I still will always use the best approach for the situation; and sometimes it is an unbound form!
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  9. #9
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Length of a Textbox (XP)

    Thank you guys so much!!! From reading the posts, I have a clearer understanding of the do's and don'ts of bound vs. unbound forms. This makes the decision of which way to go much easier. I think I will use the bound foms for my project.

    My project is to move a small database with programs, reports, etc. from a DOS based system to Access. Since only one person will be using the program, user collisions are not an issue, and with the largest table being only 3,000 records, table size is not a performance issue for a bound form. These were variables I hadn't thought about (and wouldn't have) had it not been for this discussion. Thanx again!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •