disconnect a query table in VB

K

ken F 2061

I have set up a query in excel pulling data from an access database. This is
set up in a template.

Having got the data I wish to disconnect the query table save the file and
publish. This is to ensure the receiver only gets the data and not the
connection and automatic update alert message.
 
C

Charlie

Dim DB As Database
Dim RS As Recordset
'
Set DB = DBEngine.OpenDatabase(DBName, False, False, ";pwd=PASSWORD")
Set RS = DB.OpenRecordset(Sql, dbOpenSnapshot)
'
' ... get data, etc.
'
RS.Close
Set RS = Nothing
'
DB.Close
Set DB = Nothing
 
J

Joel

Click on a cell in the query range. Then go to the following menu

Data - Import External Data - Data Range Property

Then unclick the box that says "Save query Definition". Answer Yes to
permanetly delete query
 

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