Link to home
Start Free TrialLog in
Avatar of lincstech
lincstech

asked on

Insert INTO data mismatch Access field

Hello,

I have a issue with  fields format with Microsoft Access. If I format the field to Currency or Number and use the "Insert Into" I get data type mismatch.
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

You should post the INSERT command.

This works for me:
INSERT INTO SomeTable (NumCol1, CurrCol2) VALUES (1, 2) ;
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I format the field to Currency or Number...

You should leave the values "as is" and not formatting them when inserting into the table.

1234.56 will become $1,234.56 after being formatted to currency style.  The comma separator (and the dollar symbol) will cause your sql INSERT statement to fail.

This works:

INSERT INTO SomeTable (NumCol, CurrencyCol) VALUES (1234, 1234.56) ; 

Open in new window


This will fail:
INSERT INTO SomeTable (NumCol, CurrencyCol) VALUES (1,234, 1,234.56) ; 

Open in new window


This will also fail:
INSERT INTO SomeTable (NumCol, CurrencyCol) VALUES (1,234, $1,234.56) ; 

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial