Help with Docmd.RunSql Please

S

Shadow

How can I create a UNION query with DoCmd.RunSql statement in VBA?

this doesn't work for me.

PerRst = "SELECT * FROM tblInOutDoc UNION SELECT * FROM tblTempInOutDoc;"
DoCmd.RunSQL PerRst



thanks for any kind of advice/
 
A

Allen Browne

RunSQL is for action queries.

If you want to examine the results programmatically, use OpenRecordset().
If you want to view the results on screen, use OpenQuery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DoCmd.RunSQL - Need help! 1
UNION Error 9
Select statement in code 6
Get PK or autonumber of Newly appended Record 6
How to enter this DoCmd.RunSQL 4
Apostrophes problem! 8
Record Copy 3
Select From 1

Top