Solved

text boxes

Posted on 1998-08-27
1
111 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
ID: 1431268
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

770 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