Results 1 to 3 of 3

Thread: Passing array as parameter to Access query

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Passing array as parameter to Access query

    Is it possible to pass an array as a parameter to an SQL query to retrieve data from an Access database?

    I'll be building an array in Excel that contains one to many values. These values will be used as arguments to select records from the database which will then be imported to Excel. Example. A field in a customer (Access) table is 'zip' code, which is part of the customer's address. I want to select all of the customers who are in the list of zip codes that are passed as an array parameter. If only one zip code, then I want all customers in that zip code. If more than one zip code, then I want all customers in all those zip codes.

    Thanks.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Passing array as parameter to Access query

    If you put the list of zip codes in an access table it would be simple to do.

    Code:
    Select * from customers where ZipCode In (Select zipcode from ZipCodesList)
    To do this within Excel I have no idea as I never use Excel for this type of stuff.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Re: Passing array as parameter to Access query

    Thanks. Got it working.

Posting Permissions

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



Click Here to Expand Forum to Full Width