Export query to Excel use data from the query as part of file nam

R

ram

HI All,

I'M trying to export a query to Excel and give it a file name that
represents the Maximum date in the date field of the query I'm exporting.

When I use the code below I receive an error message "Can not update.
Database or object is read only"

Code I'm using:

\\NS-WARQVFS01\MAH\ ACCOUNTING\2010\MONTHLY AUDIT &
Format(DLookup(max("CSODate"), "tblCSOIssued"), "mm-yyy") &
".xls"

Thanks for any help
 
G

Gina Whipp

ram,

I'm thinking your missing something but hard to tell what as that can't be
all the code. Are you using a Macro or TransferSpreadsheet? Is this
attached to a button? And what version of Access?

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

HI All,

I'M trying to export a query to Excel and give it a file name that
represents the Maximum date in the date field of the query I'm exporting.

When I use the code below I receive an error message "Can not update.
Database or object is read only"

Code I'm using:

\\NS-WARQVFS01\MAH\ ACCOUNTING\2010\MONTHLY AUDIT &
Format(DLookup(max("CSODate"), "tblCSOIssued"), "mm-yyy") &
".xls"

Thanks for any help
 
R

ram

HI Gina,

Yes I click a button that runs a macro with TransferSpreadsheet.

Thanks for any help

Ramone
 
G

Gina Whipp

ram,

Okay, so please post the balance of your code as it is not just the portion
you posted. We need to see the whole section in the On_Click event of that
button.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

HI Gina,

Yes I click a button that runs a macro with TransferSpreadsheet.

Thanks for any help

Ramone
 
K

Ken Snell

I'm assuming that this is the "text" in the File Name argument of the macro?
If yes, change it to this (include the = sign and the extra " characters):

="\\NS-WARQVFS01\MAH\ ACCOUNTING\2010\MONTHLY AUDIT" &
Format(DLookup(max("CSODate"), "tblCSOIssued"), "mm-yyy") &
".xls"
 

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