Choose() function with option group feed

  • Thread starter Thread starter David
  • Start date Start date
D

David

My form runs a query
I have an option group on the form which returns 1, 2 or 3 accordingly
My query contains the criteria below
like "*" & Choose([Forms]![Form1]![OptGrp],"Ops","Eng","")
When the form runs the query I get an 'input box' "Enter Parameter Value" -
the function is not receiving a 'value' from the option group.
I've tested the function (as below). It seem OK otherwise.
If i replace the first argument in the Choose function with 1 or 2 or 3 the
query returns the data set as expected, ie: records for "Ops", records for
"Eng", or all records respectively.
Any Ideas?
 
David

It all starts with the data... and you've described your form, not your data
structure.

Options groups return the values, not the labels.

If you want one, the other, or all, you might need to add some code to the
AfterUpdate event of the option group.


Regards

Jeff Boyce
Microsoft Office/Access MVP
 
1) Make sure the form is open
2) If the form is open, make sure that the name of the control is OptGroup

Normally this type of problem is caused by a misspelling of the form or
control name or by the fact that the form is not open.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Eureka! 'eval' does the trick!
like "*" & Choose(eval([Forms]![Form1]![OptGrp]),"Ops","Eng","")
 
Back
Top