Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Buttons - How to Select All?

Status
Not open for further replies.

smdemo

Programmer
Sep 15, 2002
63
US
I have a query linked to an option group on a form. The query works when I have option 1 or 2 selected, but I want to return all records if 3 is selected, but instead is not returning anything. Does anyone have any ideas?

IIf([Forms].[frmQualityReview].[optReviewed]="1","Yes") Or IIf([Forms].[frmQualityReview].[optReviewed]="2","No")


Thanks
 



Hi,

Your IIF statement returns Yes or No. You nave not coded ANYTHING for option 3, have you?

What about your SQL?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
how about
Code:
IIf([Forms].[frmQualityReview].[optReviewed]="1","Yes") Or IIf([Forms].[frmQualityReview].[optReviewed]="2","No") or(
IIf([Forms].[frmQualityReview].[optReviewed]="3","Yes") And IIf([Forms].[frmQualityReview].[optReviewed]="3","No"))
 
Skip - No, I didn't I tried too many things to get it to work, so I left that part out.

pwise - That will work for this case, but I will have to use this again on another form but will have nearly 10 options to select from and again the last being to return all values.
 
Build a user defined function that returns a value. I assume if you have 10 buttons you must be returning a string. Something like

where someField = getChoice() or getChoice() = "ALL"

public function getChoice() as string
select case forms("frmName").optGroup1
case 1
getChoice = "some value"
...
case 9
getChoice = "some other value"
case 10
getChoice = "ALL"
end function
 
First, you must understand the difference between numeric and string values. An option group value is a number, not "1" or "2" or "3" but 1, or 2, or 3 as MajP's posting notes.

I would set the criteria to something like:
Code:
Choose([Forms].[frmQualityReview].[optReviewed],"Yes","No","ZZZ")
OR [Forms].[frmQualityReview].[optReviewed] = 3
This assumes the field you are setting the criteria to is a string and not a yes/no field. If the field is yes/no then try:
Code:
Choose([Forms].[frmQualityReview].[optReviewed],-1,0,999)
OR [Forms].[frmQualityReview].[optReviewed] = 3



Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top