amiiBRO
amiiBRO

Reputation: 1

Syntax Error in CREATE TABLE Statement in MS Access

I have created a table called Customers with a CustomerID, Last Name, First Name, Address, and City, but when I tried to use the INSERT INTO to add data and ran the SQL Statement, it gives me an error: "Syntax error in CREATE TABLE statement". Below is the SQL Statement I have so far:

CREATE TABLE Customers
(
CustomerID int,
LastName varchar(50),
FirstName varchar(50),
Address varchar(50),
City varchar(50)
);

INSERT INTO (CustomerID, LastName, FirstName, Address, City) 
    VALUES ('10001', 'Smith', 'John', '1002 Danville Road', 'Louisville');

Upvotes: 0

Views: 519

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520908

You are missing the table name from your INSERT statement:

INSERT INTO Customers (CustomerID, LastName, FirstName, Address, City)
VALUES ('10001', 'Smith', 'John', '1002 Danville Road', 'Louisville');

As to why you got an error pointing to your CREATE TABLE statement (which looks correct), my guess is that Access tried to connect the botched INSERT statement to the create in an effort to parse everything correctly.

Upvotes: 1

Related Questions