Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing data from a MS query to a worksheet in Excel

Status
Not open for further replies.

gabbie10

Technical User
Jan 15, 2012
2
US
I have set the limit of data lines in a MS Query. It is set to transfer into an Excel sheet. When I refresh the data, all of the data transfers filling up the spreadsheet. The query is drawing its data from a table in MS SQL Tables. How do I limit what is pulled into the spreadsheet to match the query?

Is this a function in excel or would using VBA be a better way to handle this? If VBA is the way to go, how do I approach it?

Thanks
 

hi,

Please post the SQL code from your query.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi,

Attached is the SQL Code:

SELECT BunProoferTagTable.TagName, BunProoferTagTable.TagIndex, BunProoferFloatTable.DateAndTime, BunProoferFloatTable.Val, BunProoferFloatTable.TagIndex
FROM Franz_Springfield_DataLogging.dbo.BunProoferFloatTable BunProoferFloatTable, Franz_Springfield_DataLogging.dbo.BunProoferTagTable BunProoferTagTable
WHERE BunProoferFloatTable.TagIndex = BunProoferTagTable.TagIndex
ORDER BY BunProoferFloatTable.DateAndTime DESC

Thanks
 


Do you REALLY need all the rows from these two tables in your Excel sheet? I almost NEVER import an entire table, but I ALWAYS get exactly the data that I need. I use, what is referred to, a PARAMETER query. In the MS Query Window, open HELP and search on PARAMETER.

I often use VBA to do the parameter substitution, but, as you will see, it can be accomplished without VBA.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top