views:

86

answers:

3

Hi,

I'm using ADO-components to connect to an access database. In a column defined as text with width 50, dataaware textfields always displays 50 characters even when the actual string value contains less characters. The value gets padded with spaces, and if the textfield is not wide enough, it looks like it is empty.

Anyone got any clues?

Thanks, -Vegar

Edit: I'm using Delphi 2007.

A: 

Which version of Delphi?

And can't it be a field setting in the access database?

Gamecat
I'm using Delphi 2007.
Vegar
+1  A: 

The problem comes from using Char(50) instead of Varchar(50) when creating the table.

I still think there should be a way of displaying the unpadded value, but switching to varchar is ok.

Vegar
A: 

Are you using a query or a table component? If you are using a query then just embed the column name in Trim(). If not then use the OnGetText event on the field in question to put in the following code

  Text := Trim(Text);
Jim McKeeth