Multiple statements in a single Query

  • Thread starter Thread starter Nick Gilbert
  • Start date Start date
N

Nick Gilbert

Hi,

I'm a bit stuck with an access query.

I need to put lots of insert statements into a query like this:

insert into tblAdverts (Filename, URL) values ('sec_10_1.jpg', 'blah');
insert into tblAdverts (Filename, URL) values ('sec_11_1.jpg', 'blah');
insert into tblAdverts (Filename, URL) values ('sec_11_2.jpg', 'blah');

....but whatever I try, I can't make Access run the query. What is the
statement delimiter in Access?

If I don't put in the semicolon, it tells me "missing semicolon at end
of SQL statement", but if I do put it in, it says "characters found
after end of SQL statement".

How on earth do you delimit statements in Access? (I've only used SQL
Server and Oracle before now).

Nick...
 
Nick said:
Hi,

I'm a bit stuck with an access query.

I need to put lots of insert statements into a query like this:

insert into tblAdverts (Filename, URL) values ('sec_10_1.jpg',
'blah'); insert into tblAdverts (Filename, URL) values
('sec_11_1.jpg', 'blah'); insert into tblAdverts (Filename, URL)
values ('sec_11_2.jpg', 'blah');

...but whatever I try, I can't make Access run the query. What is the
statement delimiter in Access?

If I don't put in the semicolon, it tells me "missing semicolon at end
of SQL statement", but if I do put it in, it says "characters found
after end of SQL statement".

How on earth do you delimit statements in Access? (I've only used SQL
Server and Oracle before now).

Nick...

Access queries are limited to one statement. You can do exactly what you want
in VBA code though.

Dim db as Database
Set db = CurrentDB

db.Execute "First SQL Statement", dbFailOnError
db.Execute "Second SQL Statement", dbFailOnError
db.Execute "Third SQL Statement", dbFailOnError
 
Back
Top