The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
text field in datagrid throws error when len>100
Posted: 23 May 11 2:08 PM
|
fiogf49gjkf0d Several years ago I edited the Add Opportunity Product grdProducts to include the product.description field which is a text field. All has worked fine until today. Seems as though when you add a product to the grid and the description is larger than 100 characters it throws an exception. I edited the part and made the description 97 characters and it works - 101 it fails. The column was defined as...
Set col = grdProducts.Columns.Add(0) col.FieldName = "DESCRIPTION" col.Caption = Application.Translator.Localize("Description") col.Width = 130
And I tried...
Set col = grdProducts.Columns.Add(14) col.FieldName = "DESCRIPTION" col.Caption = Application.Translator.Localize("Description") col.Width = 130 col.paintstyle = 2
Either way fails with the same "Multiple-step operation gerated erros. check each status value." when I try to assign the value of the text field to the recordset...
.Fields("DESCRIPTION").Value = objRS.Fields("myDESCRIPTION").Value
Any suggestion on how I can store the value of the text field in a grid?
|
|
|
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 4:34 AM
|
fiogf49gjkf0d How large is the actual column in the database though ? OLEDB will choke if the field is bigger than the underlying column. I know it should be a Memo - but may have been changed?
And, if it's not filled in - this will cause same error so:
.Fields("DESCRIPTION").Value = CheckForNull(objRS.Fields("myDESCRIPTION").Value)
Fixes that.
|
|
|
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 8:32 AM
|
fiogf49gjkf0d The field size was 113 characters of the offending part. Everything under 101 characters works. I have 5 parts that have a description from 101 to 158 characters and each throw an exception unless I get them down to 100 characters or less. I have no records in the table with null values in this column. |
|
|
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 8:50 AM
|
fiogf49gjkf0d Question:
How did you define the Products Field on the RecordSet that is bound to the Grid?
Did you by any chance defined it as having only 100 characters?
e.g. .Fields.Append "DESCRIPTION", adVarChar, 100
I would suggest you review the RecordSet structure (more than likely you made that chance on the CreateProductsRSStructure function of the "Insert Opportunity Common" script.
|
|
|
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 8:51 AM
|
fiogf49gjkf0d I just test something.
The following line throws an error
.Fields("DESCRIPTION").Value = "Remote Wireless PC X Tablet T7700 Wireless Single Operator Remote (PC and Wireless Access Point are not included)"
The following works.
.Fields("DESCRIPTION").Value = "Remote Wireless PC X Tablet T7700 Wireless Single Operator Remote (PC & WAP are not included)"
So I know it has to do entirely with the grid recorset since I eliminated the other recordset. Not that this revelation helps me but.... |
|
|
| |
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 9:21 AM
|
fiogf49gjkf0d The grid will not host a Memo field, so you still need to keep it as a VarChar.
My recommendation:
Make it a VarChar 255, and then on either the SQL statement or on the Assignment take the Leftmost 255 characters.
|
|
|
| |
|
Re: text field in datagrid throws error when len>100
Posted: 24 May 11 7:34 PM
|
fiogf49gjkf0d Mike, you are correct, i was thinking groups.
As per Mike's comment, you can declare your field as Text as well (type 14), but you may also want to change your column type on the grid to hold the memo field. |
|
|
|