Link to home
Start Free TrialLog in
Avatar of Feyo
Feyo

asked on

Excute multiple delete and insert statements in same query

Is there a way to execute multiple delete or insert statements in an Access query? Think of this as an equivalent to a sql server stored procedure.

I have a database in sql server that is used by a windows app. I want to package the database with the windows application installation, so I exported it to Access. The problem is that I have several stored procedures, the functionality of which I need to reproduce. Two of the sps have multiple delete and insert statements I want to replicate in Access; hence, the question above.

Thanks.

P.S. I realize I could simply execute each delete and insert statement from the windows app, but I would like to know if there is a better way.  
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

<Is there a way to execute multiple delete or insert statements in an Access query>
unfortunately no, you have to call the query separately.

Hello Feyo,

What you can do is create a VBA sub (or less preferably, and Access macro) that will run your
deletes/inserts for you...

Regards,

Patrick
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try concanating every statement with a semi colon (;) and then execute. I dont know if that works, but should do fine.
Avatar of Feyo
Feyo

ASKER

Doesn't seem to work in an access query, or did you mean from the window app?
From the window app, try creating your insert or delete statements with ";" in between two statements and then execute them.
Avatar of Feyo

ASKER

asvforce - doesn't work, thanks for trying; jimhorn - that's what I figured. Thanks.
Avatar of Feyo

ASKER

Something is strange with the responses; they seem to be popping up after they should. So, I missed a bunch of responses at the beginning. I'll try to split up the points accordingly. Thanks for the responses.
>Something is strange with the responses; they seem to be popping up after they should.
EE has occasional problems with email notifications of comments being sent significantally after the comment is made.  They're aware of it.