Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array values?? 1

Status
Not open for further replies.

Cheech

Technical User
Nov 6, 2000
2,933
EU
Hi again,,

I hope I can explain this correctly.
I need to populate an array with the contents of several columns from a database query & then find the first occurrence of a certain string and return the array index number.

e.g. Column headings are "conf_1" conf_2" etc..

cells in these columns contain either "No" "Yes" or "Not Applicable"

I need to know which column the first occurrence of "No" occurs and return this as a numerical value?

Any Ideas?

Cheers. I dont want to go to Chelsea!!!
 
Two questions:

(1)
Are you set on using an array to accomplish this, or could you use the .fields collection of the recordset to iterate through and find the first occurence? This would be the more efficient approach, but I'm not sure if there is a special reason why you would need to put the data into an array first.

(2)
Will the occurence happen on the first record of the recordset, or might you have to move to other records to find the first occurence of what you're looking for?

lemme know -
Paul Prewett
 
(1)
No any method will do raelly.
(2)
Just one record is being used by only extracting on a unique field

Cheers. I dont want to go to Chelsea!!!
 
dim objFields, i, index
i = 0

do while i < rs.fields.count
if ucase(rs.fields.item(i)) = &quot;NO&quot; then
index = i
exit do
end if
i = i + 1
loop

Once through this loop, 'index' will hold the ordinal reference to the first field where &quot;NO&quot; occurs -- I suppose that index may be extraneous, but I like to have a separate variable to hold my value. It's just one of my things.

Does that help out?

:)
Paul Prewett
 
Sure does Paul..

shame the work is all on an Intranet otherwise I could let you have a look.

Cheers I dont want to go to Chelsea!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top