Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array - retrieve certain amount of recods for query

Hi all.
I'm trying to use for my first time, a single dimension array to use within
an external sql query.
I build the array from column A. This can be a variable amount, from 2 to 800.
However, I can only use 150 rows at a time in the query.
Below is what I have so far, in building the array. It's just the pulling
out of 150 records at a time, or the remainder to put into the sql query.

I will be building the sql query string as such:
bug_number = (bug1,bug2,bug3) --these are the numbers in the array. (must
have comma's between them)
strQuery_main = "select distinct(bug_number) from applied_bugs"

I'm unsure on how to begin pulling out the records in the array. i.e. start
off with a Do Loop then use a For Next statement, and how to actually keep
track of where I am at.

The query return will be put into an array also.

Any assistance would be greatly appreciated.

Cheers,
Dougy

---------------------



Sub QueryBugsProcedure

'Declare variables
Dim rngList As Range
Dim intMax As Integer
Dim rwCnt As Integer
Dim intArray As Integer
Dim Arr() As Long
Dim ArrResults() As Long

'Number of bugs to be included in each sql query (max 250)
intMax = 150

'Count number of bugs
Range("A1").Activate
If ActiveCell.Offset(1, 0) = Empty Then
rwCnt = 1
Else
Range(Selection, Selection.End(xlDown)).Select
rwCnt = Selection.Count
End If

'Create array
ReDim Arr(1 To rwCnt)

For Each c In Selection
If c.Value < Empty Then
i = i + 1
Arr(i) = c.Value
End If
Next c

'Move to this cell for query return
Range("B12").Activate

'count records in array checkpoint
Debug.Print UBound(Arr)




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
Array - retrieve certain amount of recods for query SteAXA Excel Programming 0 May 27th 10 10:32 PM
Retrieve result of query from Access oscar.c.marin[_2_] Excel Programming 3 November 12th 08 12:34 PM
How to retrieve last date and amount from columns? tfrentz Excel Worksheet Functions 5 October 30th 06 03:49 AM
write a query to retrieve data query New Users to Excel 1 March 17th 06 06:01 PM
Grabbing recods based on date and shift values Jay Excel Worksheet Functions 1 February 25th 05 02:42 PM


All times are GMT +1. The time now is 02:02 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"