CREATE VIEW

D

David

I'm learning SQL with MS ACCESS and my attempt to create a view is not
working...
Your assistance is appreciated. I'm good at ACCESS, just new to SQL from
scratch!

CREATE VIEW ProductCustomers
(cust_id, cust_contact) as
Select cust_id, cust_contact
from Customers;

I always get "SYNTAX ERROR with TABLE STATEMENT and VIEW is highlighted.
 
P

PieterLinden via AccessMonster.com

David said:
I'm learning SQL with MS ACCESS and my attempt to create a view is not
working...
Your assistance is appreciated. I'm good at ACCESS, just new to SQL from
scratch!

CREATE VIEW ProductCustomers
(cust_id, cust_contact) as
Select cust_id, cust_contact
from Customers;

I always get "SYNTAX ERROR with TABLE STATEMENT and VIEW is highlighted.

CREATE VIEW ProductCustomers AS
SELECT cust_id, cust_contact
FROM Customers;
 
D

David

Thank you Pieter... however, even though I cut and paste your code, I still
get the same error : SYNTAX ERROR with TABLE STATEMENT

I'm using ACCESS 2003 if this helps.
Thanks again for your time and talent.
Dave
____________________________________________________________
 
D

Douglas J. Steele

Access doesn't have views. Queries essentially are the same as views, so
create a query named ProductCustomers with SQL

Select cust_id, cust_contact
from Customers;
 
D

David

Actually, that's what I was thinking. The idea with SQL VIEW is that you can
write a query that concatenates etc then use the results in other Selects...
but unless the database is gigantic, I don't see the need for a seperate VIEW
in MS ACCESS. Thanks for clarifying...
 
V

vanderghast

Maybe the easiest way is to use the Debug Immediate window:


CurrentProject.Connection.Execute "CREATE VIEW ProductCustomers AS
SELECT cust_id, cust_contact FROM Customers;"



rather that trying it in the SQL Query window.



Vanderghast, Access MVP
 
Top