Search code examples
ms-accessms-access-2007

Excel table not importing data from properly functioning Access query


Alright, I have an Access DB which I am trying to import data from, into Excel. Specifically, I am attempting to import the results of a query which I wrote in Access.

I wrote this query in Access SQL (I have also enabled the ANSI 92 compliant syntax feature in all my Access DB's).

They query isn't any thing too mind boggling. It runs just fine in Access, all the time. No issues with Access. The problem is, that when I add a specific criteria to the WHERE clause of my query, the linked Excel file will not import the data. The Excel file just shows a table-ized area with no data.

However, with this criteria removed from the WHERE clause in my query, the linked Excel table is able to refresh just fine, and the table populates with the query results, no-problemo.

Here are pictures of the query: (I drew on the first one with the paint-brush, because it made me laugh, and I am bored in my cubicle) enter image description here

Here is a picture of the Query after the additional criteria is added, which then seems to prevent my Excel table from showing any data from the query results: enter image description here

My question is simple, why exactly (in detail, please) does this happen? Is there some sort of query size limit within Excel that I don't know about?

Also, a work-around would be nice, if possible. But I can run the query without this criteria if necessary. I am mainly more interested in knowing the reason behind this issue.


Solution

  • Once establishing a connection with you Access database have you tried going to Connections -> Properties -> Definitions Tab. Change you Command Type to SQL and copy the SQL text into the box that says Command Text. I had the same issue you're having but this appears to work around it. Works for me.