I've only had one user experience this phenomenon and it was indeed a shock
the first time she saw it happen. I explained to her that Excel is not a
multiuser application and Microsoft's penalty for attempting to overwrite the
file she currently had open was to blank the spreadsheet (but not overwrite
the current file, because she had it locked before Access could do so). (And
no, it's not an intentional penalty on Microsoft's programmers' part. It's
an unintended side effect that we can't avoid if the Excel file is open
during the export.)
I asked her if she wanted a reminder in the error message that the export
failed because she forgot to close the spreadsheet first. Something like:
"Export Failed! Please close the Excel file now, but don't attempt to save
the blank spreadsheet. Then try exporting again." She opted for the message
I suggested to you, because it didn't indicate that _she_ was the one who
forgot to close the spreadsheet first -- only that the file was currently
open, and she'd have to click the button again if she wanted to export the
current data to Excel.
As long as the users know what's going on and don't get blamed for their
slight boo-boos, they'll be happy to live with this type of side effect.
Your alternative is to use the Windows API to check whether the current user
has this file open in Excel and, if so, to close it without closing all other
files open in Excel. And if another user has the Excel file open, to do
exactly what you're currently doing: alert the user that the file is open
and the data wasn't exported.
The most cost-effective solution is to just alert the user, and not try to
fix the problem that may not even be the user's fault.
Try:
http://msdn.microsoft.com/archive/d...e/en-us/office97/html/output/F1/D6/S5B272.asp
The information about the @ sign and bold text refers to Access 97 and
earlier versions, not Access 2000 and later versions.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.