saving a query string as an SQL view in Access

B

Brian

Hi. I have a query that I build using VBA. I have to
use VBA because depending on the user input, the query
can change. An example query is:

SELECT ACCOUNT_LIST.COMPLEMENTOR FROM REP_LIST INNER JOIN
(CS_LIST INNER JOIN ACCOUNT_LIST ON CS_LIST.id =
ACCOUNT_LIST.CS) ON REP_LIST.id = ACCOUNT_LIST.REP WHERE
(((ACCOUNT_LIST.COMPLEMENTOR)='Wal-Mart'));

Is there a way, using VBA, to save that query string as
an actual Access SQL view? So then I can see it in the
query browser in Access? Thanks for any help!

Brian
 
D

Deville

Use the CreateQueryDef method.

Set qdf = db.CreateQueryDef(qdfName, QuerySQL)

Hope this helps.
 

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

Top