By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Array Values as Query Criteria

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.