PDA

View Full Version : i have a problem about fields of executed query in vba



cem babaeren
08-20-2010, 05:52 AM
hi all;

my code is the following:

---

Private Sub CommandButton1_Click()

Dim MyConnObj As New ADODB.Connection
Dim myRecSet As New ADODB.Recordset
Dim vkgs_list As New Collection
Dim getiri_list As New Collection
Dim tarih_list As New Connection

MyConnObj.Open "Provider = sqloledb;" & "Data Source=192.168.0.99;" & "Initial Catalog=BDDK_SERVER;" & "User ID=RISKUSER;" & "Password=RISKUSER;"
sqlStr = "select TARIH_DT, VKGS, GETIRI from VERIMEGRISI where VERIMEGRISI = 'USD.GOV' AND TARIH_DT > 20080501 ORDER BY TARIH_DT DESC, VKGS ASC"

myRecSet.Open sqlStr, MyConnObj, adOpenKeyset

For i = 1 To myRecSet.RecordCount
'??
'??
'??

Next
MyConnObj.Close
End Sub

---

i have two problems:

1) when i execute this query in sql 2005; i get more than 10.000 results. However i get only 1087 results in vba excel. why would it be so?

2) i have three collections defined in the code. and want to fill them with the corresponding fields in the query.. that's; tarih_list as field(1); vkgs_list as field(2); getiri_list as field(3).. how can i do that?

thanks in advance..

cem babaeren
08-23-2010, 04:58 AM
is there any suggestion? i am really stuck with that:ipray: