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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count MAX Char's in a Field

Status
Not open for further replies.

lhuegele

IS-IT--Management
Jan 24, 2002
886
US
I checked the FAQ's for this forum and didn't see anything relating to this, so I hope someone out there can help me with this one.

I have a table with a bunch of text fields in it and the field length is maxed out at 255 char's because of some import flaw or something. I want to limit the field lengths to just what is necessary to hold the data.

Is there a way to count the max number of characters in the data for each field so that I can change the field lengths to at least the max required?

Thanks for any help you can provide,
Larry
 
Ugly - but really trivial.

First query:

FldName: Len([FieldName])

Second query:

Aggregate
FldLen: Max([FldName])

Place each Function in each filed of the respective queries. Note the Italics. They indicate that you need to replace the "dummy" value witht a useful (and unique) value, such as:

Your TABLE Field's Name is StreetAddr, the expression in the first query might be:

StreetAddrLen: Len([StreetAddr])


while the second query would be:

StreetAddrMax: Max([StreetAddrLen])


MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Ah, thanks Michael, I knew someone would respond faster than I could look it up. <Grin>

Just an FYI: You can do this with just your first query example by turning grouping on and using the MAX grouping.

Thanks again! You rock,
Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top