Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Len function

Status
Not open for further replies.

mai19ea

Technical User
Nov 26, 2005
31
LY
How and when i use the "Len" function?

i read some in internet regarding this function but still i cannot understand. any one could help me and give me a simple explananation.

many thanks
 


Hi,

What do you not understand about the LEN function? It is a string function that returns the LENGTH of a string.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
The first thing to do when confused is use Access' own help files. If the item in question is something used in VBA code (such as LEN) go into the code module for any form, then invoke the help and enter the term you're interested in.

You'll get an explanation and usually (as in LEN) an example of how it's used. As Skip said, LEN returns the length of a string of text. If, say, you have a text box that holds a Parts Number, and all Parts Numbers have to be 10 characters long, you could check the entered number to be sure that it is.

In the Private Sub txtPartsNumber_BeforeUpdate() you could put this code:

If LEN(txtPartsNumber) <> 10 then

'Place a warning message here

End If

If the txtPartsNumber isn't 10 characters long, you can warn the user.

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top