|
|
|
date: Wed, 16 Jul 2008 11:22:05 -0500,
group: microsoft.public.excel.querydao
back
Re: Running MS Query returns results formatted as text
On Wed, 16 Jul 2008 11:22:05 -0500, Matt Wilson
wrote:
>The problem that occasionally occurs, seemingly at random, is that the
>results when pasted into Excel by MS Query are suddenly formatted as
>text cells, overwriting the query itself in the spreadsheet and thus
>destroying the link to Access so that no further updates can be done
>(the '!' button is subsequently greyed out). The end users may also
>save the spreadsheet and so next time around cannot update the data.
>
I've never seen anything like that before in the thousands of Access based
queries that I've done. That leads me to believe that it's one of two
things: user error or a macro.
User error, usually the problem, doesn't seem to fit here. I could see a
user unchecking the "Save Query Definition" checkbox in the Properties
dialog once, but not multiple times. And it wouldn't explain why you're
getting green triangles. Removing the definition would definitely disable
the Refresh button, but it would convert numbers into text.
That leaves an errant macro. First check all of add-ins that you have
installed (Tools > Addins). Then check for COM Add-ins.
http://www.dailydoseofexcel.com/archives/2008/07/16/determine-which-com-add-ins-are-installed/
I don't know of any commercially available add-ins that would cause this,
but if you want to list any that you have installed, someone may see
something suspect.
Until you get it sorted, it's a pretty trivial macro to set up that
QueryTable. You could put a button on the sheet that says "Recreate Query"
that runs the macro instead of saving a copy.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
date: Wed, 16 Jul 2008 16:03:46 -0500
author: Dick Kusleika
Re: Running MS Query returns results formatted as text
Dick Kusleika wrote in
microsoft.public.excel.querydao:
> I've never seen anything like that before in the thousands of Access
> based queries that I've done. That leads me to believe that it's one
> of two things: user error or a macro.
Thanks for your interesting post. I've not seen anyone else with this
problem, or at least anything posted about it on searching the Internet,
either.
The analysis toolpak add-in is installed. There are no items listed in
the COM Add-ins dialogue box.
The problem occurs across PCs including my laptop and two other PCs used,
all XP Pro with Office 2003 (but it used to occur with Office 2000 when we
had that too).
I can recreate the problem what appears to be at random without adjusting
the 'Save Query Definition' checkbox.
The cells are overwritten as text cells immediately after the '!' button
(or indeed the other refresh all button) is pressed.
Playing around some more I have now noticed that when this occurs, the
'Query from MS Access' name is removed from the drop down 'name box' list.
Looking at the name (insert | name | define) and clicking on the entry
'Query from MS Access Database' shows = 'Repairs'!$A$2:$L$218 - note some
spaces (or other non printing character) have appeared between the '=' and
the range of cells. (The sheet is called Repairs).
If I delete/remove the named range from that dialogue box it 'manually'
recreates the problem. If I manually edit the refers to and add three or
four spaces between the '=' and the range it also recreates the problem.
Removing the 'spaces' when the problem occurs I think resolves the missing
'!' refresh button.
So something odd with MS Query and interactions with named ranges.
Another thought - talking to end users they suggest 'if we use the
spreadsheet a lot then it's more likely to occur' and they also said 'it
appears to happen more frequently if we have the Access database open
too' (the users use forms in this to enter data).
In Excel's data range properties 'enable background refresh' is
ticked/checked but no other parameters under refresh control are set. I
wonder if this has anything to do with it, where a background refresh is
done after a period of time of the spreadsheet being opened, which then
causes the problem with the named ranges? End users are likely to leave
the spreadsheet open when busy and then update the records again later.
I might try unticking the 'enable background' option on one of the
machines to see what happens.
Again thanks for your post, good little mystery isn't it.
I also like the idea of a macro to put the query back, good one. And that
http://www.dailydoseofexcel.com/ website looks very interesting, I think I
might find myself spending a few hours browsing that!
- MDW.
date: Thu, 17 Jul 2008 05:02:36 -0500
author: Matt Wilson
Re: Running MS Query returns results formatted as text
On Thu, 17 Jul 2008 11:40:28 -0500, Matt Wilson
wrote:
>Dick Kusleika wrote in
>microsoft.public.excel.querydao:
>
>> Yes, it's very interesting. I would like to try to recreate this if
>> possible.
>
>Thanks for that, you should have an email...
Yep, no problem recreating it. I refreshed about 10 times with nothing.
Then the Refresh button went grey. I didn't get any green triangles, but
clearly something is wrong here. I closed without saving and tried to do it
again.
I refreshed 105 times (via UI and macro) and nothing. Four hours later, I
refreshed again and it broke. The defined name has the spaces in it just as
you described. Both times 'security.mdb' was open, but I don't know if
that's statistically significant yet.
It bothers me that I can't do it reliably. I wonder if it *ever* happens
when Access is closed. My current theory is that some macro in Access is
screwing things up. I have no evidence or even a logical sequence of events
that this is true, but since I'm grasping at straws I'm not too worried
about evidence and logic.
I'll keep investigating, but I think the next step will be me submitting a
bug to MS to see what they say. I'd like to start with a fresh Excel
workbook and mdb file, but I have a feeling I wouldn't be able to recreate
it under those circumstances.
Have you ever rebuilt the mdb file? What do you think about transfering all
of the worksheets to a new workbook and starting a new mdb? It sounds like
a big job, but I don't think it would be too bad.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
date: Sun, 20 Jul 2008 22:33:34 -0500
author: Dick Kusleika
|
|