Talk About Network

Google





Software > Access Forms > RE: Passing a v...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 44668 of 46786
Post > Topic >>

RE: Passing a variable from a form to a query (where criteria)?

by =?Utf-8?B?S2xhdHV1?= <Klatuu@[EMAIL PROTECTED] > Aug 8, 2008 at 08:08 AM

You are making it harder than it really is.
First, a query cannot reference a memory variable.  It can, however, 
reference a form control or a public function.

Your radio buttons should be in an Option Group control.  When a radio 
button, toggle button, or check box is used in an option group, it does
not 
return its own value.  It has, instead and Option Value.  You get the
value 
by referrencing the Option Group control which will returnt the value of
the 
selected button.  Option values have to be numeric integers, so this will 
work for your situation.

Add an Option Group to your form.
Add 3 radio buttons to it
Give each a value from 1 to 3.

Add the criteria to you query to reference the option group on the form:

Forms!MyForm!MyOptionGroup

That's all there is to it.
-- 
Dave Hargis, Microsoft Access MVP


"Mikael Lindqvist" wrote:

> Hi,
> 
> I've only managed to find bits and parts of how to pass variables
between 
> forms and queries - but I really need someone to write down a simple
example 
> of how to do it - and then I'll modify it from there.
> 
> WHAT I TRY TO ACHIEVE
> 
> 1) In one of my queries I want to filter one of the fields with "or 
> <variable1> or <variable2> or >variable3>
> 
> These 3 variables should be declared in a form (preferably with a 
> radio-button, where I declare "proper" values to variable1...3 if set to
TRUE 
> and a "bogus" value to varaible1...3 if set to "FALSE".
> 
> I have declared variable1 to variable 3 as variables:
> 
> Option Compare Database
> Public variable1 As Byte
> Public variable2 As Byte
> Public variable3 As Byte
> End Sub
> 
> If someone could explain:
> 
> a) How do I get radiobutton1 to write a value to variable1 and
> b) how do I call variable1 in my query?
> 
> May thanks in advance!
> 
> Kindly,
> Mikael
> Sweden
 




 5 Posts in Topic:
Passing a variable from a form to a query (where criteria)?
=?Utf-8?B?TWlrYWVsIExpbmR  2008-08-08 06:18:01 
RE: Passing a variable from a form to a query (where criteria)?
=?Utf-8?B?S2xhdHV1?= <  2008-08-08 08:08:02 
RE: Passing a variable from a form to a query (where criteria)?
=?Utf-8?B?TWlrYWVsIExpbmR  2008-08-11 05:41:01 
Re: Passing a variable from a form to a query (where criteria)?
"Douglas J. Steele&q  2008-08-11 09:02:40 
RE: Passing a variable from a form to a query (where criteria)?
=?Utf-8?B?S2xhdHV1?= <  2008-08-11 07:20:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 16:03:26 PST 2009.