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!

254 character limit in Selection Formula 1

Status
Not open for further replies.

LFCMan

Programmer
Mar 18, 2005
3
GB
I'm passing a selection formula to Crystal Reports from VB6, the formula exceeds 254 characters and I'm getting the message 'A string can be atmost 254 characters long'.

Is there a workaround for this as the formula can't be reduced in char length
 
you 've to split the result into fields of 254 chars. and then in the crystal you put them together in a text field
 
You might try this;

Code:
Mid({table.fieldname}, 1, 254) & 
Mid({table.fieldname}, 255, len({table.fieldname})-254)

Be aware that if the length of your string is less than 254 you will get an error. In that case an If statement will help.

Code:
if len({table.fieldname}) >= 254 then
  Mid({table.fieldname}, 1, 254) &
  Mid({table.fieldname}, 255, len({table.fieldname})-254)
else
  {table.fieldname};
Note that the mid statement takes the variable or field name followed by the first number which is the starting position. The second number is the length. "Len" measures the length of a string and returns that length as a number.

Hope this helps.
 
This is the Selection Formula that is created in vb and assigned to the Selection Formula property. It contains a list of Unique IDs that distinguish records from a table

{TblDiary.DiaryID} IN ('{E1E90C99-ED9A-454B-84C0-CF12C6B8E8CB}'&'{F22E95A9-0B92-499E-A708-365AAA867D32}'&'{33C1C524-D754-4908-8056-8B6FAB2262F7}'&'{A43B0007-C023-461E-92BF-AFBE8F4AA033}'&'{8DEE78CB-E65D-4CB7-AD1B-C9E6FC9FB149}'&'{7AEF2FE4-EBE7-416C-BAC2-7077F064466D}'&'{18725D86-88C7-4DF7-A58D-DF00A24CB9D0}'&'{5051DC15-8ECF-41B5-A01B-7A452A136EF9}'&'{D1CD0296-CABC-4D93-9043-278EED98C8CF}'&'{92E46C27-458B-4E65-9477-DBA902F2572F}'&'{C13FED24-6BA3-4A92-AC72-DEC32AEF931C}'&'{C40FE333-369F-4C16-B57F-91EA80855309}'&'{4954B501-9136-4207-816D-45A0E3BFF40B}')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top