A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

text field formatting



 
 
Thread Tools Display Modes
  #1  
Old October 29th, 2004, 07:14 AM
dave
external usenet poster
 
Posts: n/a
Default text field formatting

i m using access 2003 and designing one forms which has
two text field..one for name and another for address..
in address field, i have multiple line enabled and i want
to resrict to maximum number of lines only to 3.
in the name field, i want to change string to proper once
focus is lost..i.e.
mr. abc xyz--------Mr. Abc Xyz
MR. ABC XYZ--------Mr. Abc Xyz
and address text field can have maximum 3 lines..user
should not be able to enter 4th line..

any help would be appreciated..

thnx in advance
dave

  #2  
Old October 29th, 2004, 07:50 AM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default

You can put the following code in the before update event


If IsNull(Me.Address) = False Then

If UBound(Split(Me.Address, vbCrLf), 1) 2 Then
Cancel = True
MsgBox "You are only allowed 3 lines max", vbExclamation
End If
End If


The split command produces a zero based array...so, "2" means 3 lines....


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Must # of fields in the 2 tables in an Append Query be equal? CreativeImages Running & Setting Up Queries 3 October 1st, 2004 05:16 PM
Can you prevent the text following a text form field from shiftin. ldickers General Discussion 1 September 16th, 2004 09:50 PM
Printing text field on a report with leading and ending "*" Jim Halbert General Discussion 1 July 28th, 2004 12:29 AM
Linked Table field...strip off leading zeros of text Inyo55 Database Design 1 July 24th, 2004 01:11 AM


All times are GMT +1. The time now is 04:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.