473,666 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Limiting a Text Field's Input Size !

I've used Dbase/Clipper for years & Access for a little while now but
Access doesn't seem to have any elegant solution to limiting the size
of a text box ... i.e. the max number of characters that can be
entered into a text box.

In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line
elegant solution ..
@ row, col get variable picture "@R50"

or ... I could say var1=space(50)

Now when I try to enter data into var1 it will allow a max of 50
characters.

Why don't the Access team make a small property specifying the max num
of characters enterable ?

I have seen Allen Browne's solution:
http://allenbrowne.com/ser-34.html

I was just wondering if there's anything better.

I tried using the format property with "C" repeated say 30 times ...
but when entering data into the box I now see an underline/underscore
over which I have to type ... looks ugly !

Also ... when I click in the text box, the cursor goes somewhere in
the middle of the text box & I have to press the home key to go to the
beginning. Is there any workaround for this ?
Thx & Best Rgds,
Prakash.
Feb 25 '08 #1
2 1970

<pr************ *@gmail.comschr eef in bericht news:31******** *************** ***********@e60 g2000hsh.google groups.com...
There are 3 UNBOUND textboxes on this form for which I'd like the foll
behaviour:
if the text box is empty, then whenever the text box gets focus, the
cursor should go to the 1st character ... else it should follow the
default behaviour.

Would it be possible for either you or anyone else on this NG to
please post some sample code which would permit me to do this ?

Well I don't use inputmasks that much (I hate them), but sometimes when I need them I write simple code like:

If IsNull(Me!Field WithInputMask) then
Me!FieldWithInp utmask.SelStart =0
Me!FieldWithInp utmask.SelLengt h=0
End if

btw: I am using the click event (user clicks with mouse)

Arno R
Feb 25 '08 #2
Arno, and Salad have posted some code.

just go:

If IsNull(Me.Text5 ) = True Then
Me.Text5.SelSta rt = 0
End If

If the field has somthing in it already...then it not null, and the above
code will not run, and you get default behavour...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
Feb 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
148593
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected value="">Please make a selection</option> <option value="1">Choice 1</option> <option value="2">Choice 2</option> <option value="3">Choice 3</option>
3
13999
by: Mark | last post by:
Hi, Im trying to validate a form, all the validating works apart from one field. This particular field must consist of the first 2 characters as letters, & the following 5 as numbers. And if it dosent meet these requirments an error message will be displayed. I have pasted the code (and highlighted the relevant parts) below in the hope that someone can help me out with this. Ive been trying to suss it out all week & it's driving me nuts!...
7
1858
by: Adam Smith | last post by:
Hello, Designing a form, with field layout in a table to maintain consistency in appearance. Table field heights set to 13 pxs. Textfield default height is 24 pxs. how can I reduce it so as to prevent "Form Sprawl". Thanks -- Adam --
3
2198
by: Roy Adams | last post by:
Hi I'm reposting this question because for some reason can't post follow up question to this thread. What I'm trying to do is put the value and text from a a select in to a text field and to a hidden field respectfully and the value from dynamically created hidden fiields in to a text fieldin to a text field all at the same time Here's the code as viewed through the browser <body bgcolor="#FFFFFF" text="#000000" > <SCRIPT...
9
4751
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and DataSet; and all I'm doing is showing one record in text fields, allowing the user to modify the text fields, and then updating the database again when the user clicks the Save button. The fields already show the correct data record since I have...
3
5939
by: DBQueen | last post by:
How can I limit the size of a Memo field? I don't want the user to be able to enter more than 500 characters. Thanks! Andi
1
2637
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have been easy to resolve but just doesn't seem to work for me ... The original application includes a form page for editing the details of an "item". In my case the item is a comicbook. The page functions just fine as long as I stick with text fields, but I...
7
3112
by: kirkgilbert | last post by:
I am trying to do an onchange event in a form using a text field. The form is tied to a record set that is part of a repeated region. One the first record when I edit the data it works perfectly. When I go to the second record nothing happens. I have attached the code below: I bolded text that contains the javascript and fields this is applied to <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="Connections/FutureOrders.asp"...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.