Murray Brown
asked on
Access SQL Create Table
Hi
I am trying to create a table with a Decimal column called "Test"
using the following code, but am getting a syntax error with:
[Test] DECIMAL (10,2),
CREATE TABLE tblTest
(CustomerID INTEGER NOT NULL,
[Test] DECIMAL (10,2),
[First Name] TEXT(50) NOT NULL,
Phone TEXT(10),
Email TEXT(50))
I am trying to create a table with a Decimal column called "Test"
using the following code, but am getting a syntax error with:
[Test] DECIMAL (10,2),
CREATE TABLE tblTest
(CustomerID INTEGER NOT NULL,
[Test] DECIMAL (10,2),
[First Name] TEXT(50) NOT NULL,
Phone TEXT(10),
Email TEXT(50))
A field of type DECIMAL cannot be created in an Access database using DAO, but it can be done with ADO.
Instead of CurrentDb.Execute strDDL,
use CurrentProject.Connection. Execute strDDL
Best wishes,
Graham Mandeno [Access MVP 1996-2013]
Instead of CurrentDb.Execute strDDL,
use CurrentProject.Connection.
Best wishes,
Graham Mandeno [Access MVP 1996-2013]
ASKER
Hi
Thanks. What would the full ADO code look like?
Thanks. What would the full ADO code look like?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
I should have mentioned that I am building this in VB.net/VSTO
I should have mentioned that I am building this in VB.net/VSTO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much. Should have realised that. Got into a tangle with all the different approaches on the net.
Thanks, Scott. I've been out all day so I wasn't here to fill in the cracks :-)
Cheers,
Graham
Cheers,
Graham
If you want 2 decimal places, use the table field DecimalPlaces property, Format property, or the format function.