+ Reply to Thread
Results 1 to 2 of 2

VBA to return an array from sql select

  1. #1
    Registered User
    Join Date
    10-29-2014
    Location
    Kettering, England
    MS-Off Ver
    2010
    Posts
    1

    Question VBA to return an array from sql select

    I am Very new to programming with any language so please help.

    I am trying to return an array from an SQL Select but so far only get the same line of data repeated. I think I may need to loop through the data but cant work out how.
    All suggestions gratefully received.
    Ideally what I would like is to be able to get the data and display this in a list box for the user to select from
    The data fist needs to be filtered down hence the select LIKE statement

    My Code so far is as follows:

    Please Login or Register  to view this content.
    Last edited by The Bidd; 11-03-2014 at 04:35 AM.

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: VBA to return an array from sql select

    When posting, please follow forum rules and enclose code in code tags. Please edit your above post accordingly.

    That being said, the following code
    Please Login or Register  to view this content.
    is returning a single value and plugging it into the entire range. You need a loop that returns the results one at a time (until EOF) into the individual cells of the range.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to return address of the column or cell I select, not just return the value?
    By qzqzjcjp in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-18-2014, 04:57 PM
  2. Replies: 0
    Last Post: 10-13-2012, 10:13 PM
  3. Find a value in an array and return multiple values in an adjacent array
    By tonbra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 08:35 PM
  4. Select items based on criteria and return in an array
    By apolloni in forum Excel General
    Replies: 4
    Last Post: 07-02-2010, 07:31 AM
  5. select variables ranges, copy to array, paste the array in new workbook
    By Mathew in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2005, 05:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1