A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Public string var as criteria for query?



 
 
Thread Tools Display Modes
  #1  
Old July 15th, 2008, 06:54 PM posted to microsoft.public.access.queries
Rich[_17_]
external usenet poster
 
Posts: 23
Default Public string var as criteria for query?

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
  #2  
Old July 16th, 2008, 02:51 AM posted to microsoft.public.access.queries
MGFoster
external usenet poster
 
Posts: 653
Default Public string var as criteria for query?

Rich wrote:
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-----
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.