Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Looping Through A Recordset

Couple of thoughts.

What cursor are you using. ForwardOnly is by far the most efficient
rs.Open src, cnn, adOpenForwardOnly

Secondly, you could try do the selection with a recordset filter rather than
in the SQL. The SQL query should be considerably faster, but you will need
to test it to see whether the recordset filter is quicker than a query
select.

Finally, although I haven't tried it myself to check if it is more
efficient, you could load the recordset into an array suing the GetRows
method, and then loop through the array

aryData = GetRows(src)

--

HTH
are you using
Bob Phillips

"ibeetb" wrote in message
...
I am looping through a recordset but it is taking FOREVER. It is a DB

field
that I am trying to collect a Disitinct list from. Here is the code: By

the
way, this code is tunning in Excel using ADO...
By the way, there are a total 0f 55000 records to loop through. Anyway I

can
make this faster. It takes 5-6 minutes to create a distinct recordset


'Fills the Teams list box with available team names
src = "SELECT DISTINCT
public.tts_time_weekly_report_display.team_name "
src = src & "FROM public.tts_time_weekly_report_display "
src = src & "WHERE
public.tts_time_weekly_report_display.tts_time_wee k_worked '12/31/2002'

"
rs.Open Source:=src, ActiveConnection:=cnn

Do While Not rs.EOF
frmTeams.lstTeam.RowSource = rs
frmTeams.lstTeam.AddItem rs.Fields("team_name").Value
rs.MoveNext
Loop






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
query a recordset SAm Excel Discussion (Misc queries) 2 May 1st 07 09:33 PM
return recordset Laurent M Excel Discussion (Misc queries) 4 January 26th 05 09:43 AM
create recordset from csv file on web Robbie[_2_] Excel Programming 0 August 12th 03 04:00 AM
ADO slow recordset getrows RB Smissaert Excel Programming 4 August 10th 03 08:22 PM
ADODB Recordset Seth[_3_] Excel Programming 0 August 5th 03 02:15 PM


All times are GMT +1. The time now is 08:10 PM.

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"