security warning in access 2007 copying query with doCmd.transferdatabase

S

SJ

I have a query in Access and export the results as a table in an Access
database in the same directory. This works fine in Access 2003. However,
in Access 2007, a security message displays and the user is prompted to
choose open or cancel.

My code is below. It copies the query results to a new database and names
the table in the destination database the same name as the query in the
source database.

Sub CopyQueryResultsToTemp(sQuery As String)
Dim LFilename As String
LFilename = Application.CurrentProject.Path & \Temp.mdb
DoCmd.TransferDatabase acExport, "Microsoft Access", LFilename, acTable,
sQuery, sQuery, False
End Sub

Any suggestions appreciated.
 

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