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

  • Thread starter Thread starter ram
  • Start date Start date
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
 
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
 
HI Gina,

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

Thanks for any help

Ramone
 
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
 
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"
 
Back
Top