Public string var as criteria for query?

R

Rich

Hello,

Trying to see if this is possible.

I have a select query that is run from an onClick button on an options
form (user can run report on variety of items - some multiple selection
list boxes). I am trying to build the criteria statement in vb (as a
string) and pass that to the query using a Public variable. I am trying
to enter the Public variable in the criteria field in the select query,
so the string is correctly formatted and selects only the items the user
wants for that field. I am using 2 multiple selection list boxes for
options, so I am trying to build each to pass in to the query. I also
need to use the same selection for several reports back to back, so that
is why I am using the public variables to store the criteria strings.
Also, referencing several tables in query.

I hope I explained that enough. Is there a better/different way to do
this? Is this even possible?

Thanks in advance.
RJC
 
M

MGFoster

Rich said:
Hello,

Trying to see if this is possible.

I have a select query that is run from an onClick button on an options
form (user can run report on variety of items - some multiple selection
list boxes). I am trying to build the criteria statement in vb (as a
string) and pass that to the query using a Public variable. I am trying
to enter the Public variable in the criteria field in the select query,
so the string is correctly formatted and selects only the items the user
wants for that field. I am using 2 multiple selection list boxes for
options, so I am trying to build each to pass in to the query. I also
need to use the same selection for several reports back to back, so that
is why I am using the public variables to store the criteria strings.
Also, referencing several tables in query.

I hope I explained that enough. Is there a better/different way to do
this? Is this even possible?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use a Public Function to pass the Public variable, which shud
actually be a Private variable, to the queries. Ex:

' the Declaration section
Private intLimit As Integer

------
Public Function UpperLimit() As Integer
UpperLimit = intLimit
End Function

Then in the queries use the name of the function as a Parameter, ex:

PARAMETERS UpperLimit Integer;
SELECT ...
FROM ...
WHERE limit_column = UpperLimit

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **


-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSH1UMoechKqOuFEgEQLjvgCeK8hichZ6g95W5DX4/0eD2fHXxJMAn2yP
2QmemKCxEEBPyb+hdPiOuCB0
=72p5
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top