Solved

text boxes

Posted on 1998-08-27
1
108 Views
Last Modified: 2010-04-30
Hello
I want my text boxes to have the same lenght as the database fields and don't let the user to write after that lenght so it doesn't give me the error that I exceed the lenght of the field.
Can you help me?

Thanks
Alberto
0
Comment
Question by:asimoes
1 Comment
 
LVL 14

Accepted Solution

by:
waty earned 200 total points
Comment Utility
The first solution
You have to set all your textbox.maxlength to the length of your field :

tbTextbox.MaxLength = Fields(4).FieldSize

The second solution
You can take all the maximum needed left character of your textbox in your record. This will ignore extra characters :

Fields(4).Value = Left(tbTextBox.Text, Fields(4).FieldSize)

NB : Adapt the code for your needs.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now