LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL Issue retriving data from SQL

Hello ppl,

The first thing of all i apologize myself for my bad English.

Ok, a little bit of history, i write a VBA macro for EXCEL that retrieves
information from an SP in SQL Server 2K, and is not the first macro that i
write, i have already writed a lot of this macros but this is the first time
i get this issue, and i can't figure it out how to solve it.

Ej.
I have a query that retrieve information from some tables, it group the
results, and make some maths and return a single row per document, i tested
this view and works fine when you execute it from Query Analyzer, or the MMC

The following image is an example of the data returned by the query in the
query analyzer.
http://www.vycmex.com.mx/temporales/..._singlerow.JPG

As you can see there is a set of records returned, but we will focus on the
one higlighted, only one row returned by the SP, also you can notice that Im
using the tools from SQL Server 2008, but the server is 2K (this is just a
note)

Now i execute the same stored procedure from my macro in EXCEL, and
sometimes not always i get some changed rows, and not all, only one or two
records.

The following image shows the same record i already show in the last image
but in EXCEL the row is ungrouped, why? How? i dont know. also you can
notice that if you sum the values of the cols SUBTOTAL, IVA, IMPORTE, you get
the same values that i get in the Query Analyzer. (also the image showed uses
office 2007 pofessional, but i get the same result in Office 2K, and 2003)
http://www.vycmex.com.mx/temporales/...ultiplerow.JPG

So what things I have already tried,
- I change the way I import the data from SQL to EXCEL, I used the
instruction varHoja.Range().CopyFromRecordset rstResultados, also i write a
routine that gets value by value the result from the recordset and copy it in
the EXCEL Sheet. I change the way i connect to the database, ODBC, ADO,
ADO.NET

- I rewrite the query thinking that it was the cause but i already change it
two times, and i get the same result.
So at this point i feel a little bit frustrated, and i hope someone in this
forum can help me to figure it out this issue.

Thanks in advance and best regards.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retriving text from a column JAF-In[_2_] Excel Discussion (Misc queries) 6 July 5th 09 03:08 PM
retriving specific data????? wt.pm Excel Worksheet Functions 3 April 1st 09 10:55 PM
Retriving name of cobntrolelement Jan Kronsell Excel Programming 1 June 9th 06 05:23 PM
Help with retriving data from other closed Workbooks parteegolfer Excel Programming 3 March 25th 06 08:09 PM
Retriving a deleted version of Excel gsp56 Excel Worksheet Functions 1 January 28th 05 03:01 PM


All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"