Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default "Querytables.add" in a loop; result is insert in a new row each t

Hi, here is the problem I have: the macro s result is instead of inserting
the data in the cell of the next row(Range("K" & R & ""), a new column is
created each time.
Can you figured out the problem?

Do Until Cells(R, 5) = "TOTAL:"

R = 8
FrstDay = 7
LastDay = 14
Card1 = Cells(R, 4)
Sqlstring = "select sum(Temps_Arrondi) from Presence_BCV_App where
_Card= '" & Card1 & "' and ([Date] '" & FrstDay
& "' and
_[Date] < '" & LastDay & "') "
connstring = "ODBC;DSN=DEV_DCI;UID=sa;PWD=abcde;Database=DEV_DC I"

With ActiveSheet.QueryTables.Add(Connection:=connstring ,
Destination:=
_Range("K" & R),
Sql:=sqlstring)
.Refresh BackgroundQuery = False
End With

R = R + 1
Loop
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default "Querytables.add" in a loop; result is insert in a new row each t

It seems like when the datas is going to be inserted and the last Sql request
is not complete is the source of the problem.
In that case, what is the method/property with "querytables.add" to insert
the data no matter what else is done?
Please don't use that like the answer to the problem.
I'm only supposing at this point.
Reply
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
Formula Result is "V6", need Excel to use cell "V6", not the resul Erik Excel Worksheet Functions 3 September 5th 08 03:10 PM
when a "check box" is checked, a "result" to be shown in another c Lisa Ann Kashner Excel Discussion (Misc queries) 2 November 6th 07 01:32 AM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


All times are GMT +1. The time now is 04:56 PM.

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

About Us

"It's about Microsoft Excel"