Search code examples
sqlms-access

Access SQL convert table field text into number


In an Access Database with multiple tables, one [table = "IT9001"] gets monthly updated via new import, so the format resets monthly, too. One column hat the format text but I need it in long integer.

current SQL: alter table [IT9001] alter column [numbers] LONG;

After this the field type is long integer, but the numbers are still shown as text (on the left side), because the field format has an "@" in it, like any other field with text, too. If I remove the "@" they are shown as numbers (orientation on the right side). How do I change the field format and delete the "@"?

And I am not going to use the import assistant (or what ever it's called) to change the format manually. The data gets imported in the same type as it is in the excel file.

Thank you for your help! :)


Solution

  • You can't manage a field's Format property with Access SQL.

    Use VBA to remove it from the field's Properties:

    CurrentDb.TableDefs("IT9001").Fields("numbers").Properties.Delete "Format"