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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|