Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default Query using list of parameters

Is it possible to limit query results by a list of data or an aray rather
than a single parameter?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Query using list of parameters


You may want to import the entire table into excel and then use Advance
filters in Excel to filter the table.

A query uses SQL language which Microsoft call the command Text part of
the query. I'm not an expert on SQL but know a lot about SQL language.
I haven't seen any way of automatically getting data from a table but
somebody else may be able to answer that part of your question.

A SQL statement can be very long and contain multiple WHERE phases. If
you were to create your own SQL statement using a macro each entry in
your Table would be another WHERE phase of the SQL.

Instead of using a Query you can write a macro using the ADO method to
get the data. The Query method has one advantage over the ADO method in
that it will automatically refresh. You can achieve the same results
using the ADO method by using a timer to automatically run a macro to
refresh your data.

So here are some of the choices you can do using VBA to get the data

1) Create a query with Multiple Where phases which will refresh
automatically
2) Create a macro that uses the ADO method and run manually using SQL.
3) Use ADO method and don't create a query. You can use the recordset
method which will loop through every row of the table and then select
the data you want like you would stepping through an excel Worksheet.


There is very little differences between an excel spreadsheet and an
access database table. All Microsoft Office programs use the same file
structure which contains documents, tables charts, pictures, slides. An
Excel worksheet is a table just like an access database table and all
commands in VBA that you can use in a worksheet can also be used in a
table.. You can even open an excel worksheet using the ADO method. The
ADO method is sometimes useful on large Excel files becaue it doesn't
open the file which uses a lot of memory and is slow. Instead you make
a connection to the file.

I hope I didn't confuse your too much. I'm not a mind reader and don't
know exactly what you are trying to accomplish. if you have only 5 to
10 items in your table creating a SQL with multiple where statement
might be the best method to use. You also can get the entire table and
then write VBA code to filter the items use Advance filters which does
have a table structure.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=185278

Excel Live Chat

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
MS Query - 2 Parameters cottage6 Excel Discussion (Misc queries) 2 July 17th 08 09:16 PM
Query parameters Lac Excel Programming 0 June 13th 06 12:59 PM
Query Parameters Texas_Toast Excel Discussion (Misc queries) 0 January 11th 06 03:14 PM
Web Query Parameters raboo2u Excel Programming 4 January 11th 04 08:54 PM
Query Parameters Jeff Excel Programming 1 November 18th 03 05:47 PM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"