DontFretBrett
DontFretBrett

Reputation: 1165

What's wrong with my SQL statement?

SELECT * FROM [makes$] WHERE "Corporate Name"='Champion Enterprises, Inc.'

I'm running this query on an XLS excel file using ADO in VBA. There are about 10-20 records containing this corporate name but it returns EOF.

I'm fairly new to database but I'm certain everything is correct aside from my SQL statement.

If I SELECT * FROM [makes$], it returns all the records successfully.

Upvotes: 0

Views: 126

Answers (3)

Detect
Detect

Reputation: 2069

SELECT * FROM [makes$] WHERE [Corporate Name]='Champion Enterprises, Inc.'

Upvotes: 4

jball
jball

Reputation: 25014

Use [] instead of "" for column names with spaces in them:

SELECT * FROM [makes$] WHERE [Corporate Name]='Champion Enterprises, Inc.'

Upvotes: 1

Conrad Frix
Conrad Frix

Reputation: 52645

total guess here but its probably

SELECT * FROM [makes$] WHERE [Corporate Name]="Champion Enterprises, Inc."

Upvotes: 2

Related Questions