Parameter passed from a form to a query

  • Thread starter Joseph Greenberg
  • Start date
J

Joseph Greenberg

Using Access 2007.

I have a simple form with an opton button array. I want to pass a paramter
based on which option value is selected (there is a default one) - they are
in a frame called fraMemberType. The query currently has a parameter called
[Who]. The possible values that I want to use are "<3", ">2", or ">0" (and
no, thiis isn't the text of the option values). How can I insert one of
these values (without the quotes, of course) into my parameter [Who]?

Thanks.
 
J

Jerry Whittle

Not really. As a parameter Access would see it as ="<3" or =">2" if you
define the parameter as text and probably throw an error if defined as a
number.

You might be able to build an SQL string in a module that could use the form
field.
 
J

Joseph Greenberg

The only other way I can think to do this is to define a global variable,
reinitialize it to blank at the end of the proc that calls the query, and
set the global variable in the click event of the option buttons. this seems
wasteful, but it should work, right?

Jerry Whittle said:
Not really. As a parameter Access would see it as ="<3" or =">2" if you
define the parameter as text and probably throw an error if defined as a
number.

You might be able to build an SQL string in a module that could use the
form
field.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Joseph Greenberg said:
Using Access 2007.

I have a simple form with an opton button array. I want to pass a
paramter
based on which option value is selected (there is a default one) - they
are
in a frame called fraMemberType. The query currently has a parameter
called
[Who]. The possible values that I want to use are "<3", ">2", or ">0"
(and
no, thiis isn't the text of the option values). How can I insert one of
these values (without the quotes, of course) into my parameter [Who]?

Thanks.
 
J

Joseph Greenberg

and one other follow-up question - would it be possible to pass the index
value to the query (like if I didn't need the greater than or less than
signs)?

Jerry Whittle said:
Not really. As a parameter Access would see it as ="<3" or =">2" if you
define the parameter as text and probably throw an error if defined as a
number.

You might be able to build an SQL string in a module that could use the
form
field.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Joseph Greenberg said:
Using Access 2007.

I have a simple form with an opton button array. I want to pass a
paramter
based on which option value is selected (there is a default one) - they
are
in a frame called fraMemberType. The query currently has a parameter
called
[Who]. The possible values that I want to use are "<3", ">2", or ">0"
(and
no, thiis isn't the text of the option values). How can I insert one of
these values (without the quotes, of course) into my parameter [Who]?

Thanks.
 

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