473,378 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Array Values as Query Criteria

I am working with a database and I would like to be able to populate
an array at run time and then use the values that were pushed into the
array as criteria for a select query. It seems that this should be
possible to so. Here is an example...

Lets assume:

I have a query called qSelectAgencyData and has the field (among
others) AgencyCode.
I have an array declared called CodeList.
I have a list box on my form called lbAgency.

I want to populate the array with the valuse selected in the list box,
then I want to use the array values as the criteria when I run
qSelectAgencyData so that only the agencies selected in the list box
are included. I know you can ditectly use the list box to establish
the where clause, but for what I need to do that will not suffice and
I need to pass it through an array.

Thanks...

Mar 9 '07 #1
1 7329
I am not sure why you "need to pass through an array", nor even what that
means. I suspect it means that you believe this to be the only way to
accomplish what you want, and it may be, but as we don't really know what
you are trying to accomplish, it would not be obvious to us.

You cannot refer to an array (part of the VBA code) in a Query nor directly
in SQL. I would build the SQL with VBA code. You can, of course, begin
with a Query you construct with the QueryBuilder, then obtain the basic SQL
by looking at its SQL View.

Larry Linson
Microsoft Access MVP

"DavidB" <je***@yahoo.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
>I am working with a database and I would like to be able to populate
an array at run time and then use the values that were pushed into the
array as criteria for a select query. It seems that this should be
possible to so. Here is an example...

Lets assume:

I have a query called qSelectAgencyData and has the field (among
others) AgencyCode.
I have an array declared called CodeList.
I have a list box on my form called lbAgency.

I want to populate the array with the valuse selected in the list box,
then I want to use the array values as the criteria when I run
qSelectAgencyData so that only the agencies selected in the list box
are included. I know you can ditectly use the list box to establish
the where clause, but for what I need to do that will not suffice and
I need to pass it through an array.

Thanks...

Mar 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: AAVF | last post by:
Hi We have a problem with a query. An Access database links via ODBC to a UNIX server. To speed things, we use the ODBC to load the relevant tables to the local PC that runs Access so that...
3
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and...
2
by: Todd D. Levy | last post by:
I have a table of Country names & Country codes in alphabetical order. This is a lookup table that a number of other tables use to populate the Country field via a drop down Combo Box on the...
2
by: RBohannon | last post by:
I have a report with most fields populated by a query. However, some of the fields are variable in such a way that their values cannot be queried from a table. At present the values for these...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
4
by: Fendi Baba | last post by:
I am creating a simple project information database. In the project information form 1 have two subforms. one contains organization involved - many organzation can be involved - and another list of...
6
by: Bez | last post by:
I have created a querie from a Form with differents search criteria on the form when i search for a comopany begining with "a" for example it will bring up all the companies begining with "a" but...
10
by: Trevor2007 | last post by:
I have a query that setting date from and date to from form values works: >=!! And <=!! but now I am trying to add another peramiter to pass in adition to above and now it doesn't work, I get...
7
by: servantofone | last post by:
I'm using Access 2003. I'm building a query and wish to display all records with values in a certain field (HIST) made up of all zeros. The field has a range of text values including alpha-numeric...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.