gogetsome
asked on
Need help with simple access sql statement
Hello, I'm trying to understand why the following does not work in Access SQL. Please forgive the basic crud. This would work in MS SQL, but when I try it in Access I get the following error:
Syntax error in from clause
What am I doing wrong?
DELETE * FROM Table1
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, '10/10/2012','10/10/2012')
Select * from Table1;
Syntax error in from clause
What am I doing wrong?
DELETE * FROM Table1
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, '10/10/2012','10/10/2012')
Select * from Table1;
INSERT INTO Table1(email, productid, datecreated, datesend) values('adf', 5, '10/10/2012','10/10/2012')
You can not have a space after values
You can not have a space after values
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This does not work as well, with same error
DELETE * FROM Table1
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, #10/10/2012#,#10/10/2012#)
Select * from Table1;
gustav, are you say in access sql you can't run multiple statements in one query?
DELETE * FROM Table1
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, #10/10/2012#,#10/10/2012#)
Select * from Table1;
gustav, are you say in access sql you can't run multiple statements in one query?
Yes.
But you can easily execute one after the other.
/gustav
But you can easily execute one after the other.
/gustav
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can run multiple separate sql statements using vba codes, this will run the queries in succession
docmd.runsql "DELETE * FROM Table1"
docmd.runsql "INSERT INTO Table1(email, productid, datecreated, datesend) values('adf', 5, #10/10/2012#,#10/10/2012#) "
docmd.runsql "DELETE * FROM Table1"
docmd.runsql "INSERT INTO Table1(email, productid, datecreated, datesend) values('adf', 5, #10/10/2012#,#10/10/2012#)
ASKER
Okay, making much more sense now... I suppose I need to do what I want in VBA to execute the various queries I need?
How should I divide up the points? :-)
How should I divide up the points? :-)
ASKER
Thanks guys!
;-)
try this
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, #10/10/2012#,#10/10/2012#)