Array Values > Functions?

Results 1 to 2 of 2

Thread: Array Values > Functions?

  1. #1
    Join Date
    Dec 1969

    Default Array Values > Functions?

    I was wondering if anyone can help me, I have created a user defined function to query a table. My problem is that I now need to return multiple values from the table as opposed to one field.<BR><BR>I thought the best way to do this would be to pass the values in to an array and then pass this to the function. However at the moment I am unsure how to pass the full contents of an array to a function. Does anyone know?<BR><BR>The code I am using:<BR><BR> dim CompanyArray(1)<BR> CompanyArray(0) = objRS(0)<BR> CompanyArray(1) = objRS(1)<BR> <BR> Company = CompanyArray()<BR>

  2. #2
    Join Date
    Dec 1969

    Default Use rs.getrows

    using getrows gives you an array of the records.<BR><BR>yourquery...<BR>set rs = conn.execute yourquery<BR><BR>arrRecords = rs.RetRows()<BR><BR>rs.close<BR><BR>arrRecords is now an array of all items you selected in your query...<BR><BR>Function MyResults(arrRecords)<BR> &#039;do whatever you want to perform on data<BR>End Function<BR><BR>Now call your Function<BR><BR>MyResults(arrRecords) <BR><BR>Just remember, functions can only return 1 result<BR>if you need to return many results then best to use a sub.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts