Jotita,
Well, one solution to "Fix" your existing data is to simply issue a replace all on the field, for example:
REPLACE ALL CITH WITH ALLTRIM(CITY)
This will remove the unwanted spaces from the front and back. If it is sporadic in your table, the most likely cause is, as Ramani suggested, an import field. Long term, there are a few ways to deal with this.
Part of the speed of Fox in import situations is the ability to bring in fixed length data, or named fields from an excel spreadsheet, without haveing to specify each field. What I would do in this case, instead of importing them directly into your main table, is first import them into a staging table, where you do data clensing first. That staging DBF would have the same structure as your final DBF. Bring in the records, always process a few things against it like the replace all I listed above to remove unwanted spaces, and then just append it to the final table with:
SELECT <Production.DBF>
APPEND FROM <Staging.DBF>
Where "Production.DBF" is the final location for the data, and "Staging.DBF" is the interim table. Make sure you "Empty" the staging table each time before bringing in a new batch of data to clense.
Thanks,
-Scott
Please let me know if this has helped! s-)