473,320 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Filter Subform with Radio Buttons

35 32bit
Hello,

I am trying to change a filter for a subform (Default) that has a filter based on a drop down box with a Search button to a filter based on radio buttons.

However, I don't understand the current query enough to begin to change it. Here is the command that opens the query which has a subquery as well.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery ("QryAccounts")
Here is the part of the query I am having difficulty with:

Expand|Select|Wrap|Line Numbers
  1. FROM QryAccountsSub 
  2.    LEFT JOIN ActiveUsers 
  3.       ON QryAccountsSub.[Account Number] 
  4.          = ActiveUsers.[Account Number]
  5. WHERE ((
  6.    (QryAccountsSub.[Account Number])
  7.       =IIf(IsNull([Forms]![Default]![Account])
  8.          ,[QryAccountsSub].[Account Number]
  9.          ,([Forms]![Default]![Account]))) 
  10.        AND 
  11.          ((QryAccountsSub.QQ)
  12.             =IIf(IsNull([Forms]![Default]![st])
  13.             ,[QQ]
  14.             ,IIf([Forms]![Default]![st]="All"
  15.                ,[QQ]
  16.                ,IIf([Forms]![Default]![st]="Pre-Installed"
  17.                   ,1
  18.                   ,IIf([Forms]![Default]![st]="Q Accounts"
  19.                      ,0
  20.                      ,[QQ]))))) 
  21.        AND
  22.           ((QryAccountsSub.Act)
  23.             =IIf(IsNull([Forms]![Default]![st])
  24.             ,1
  25.             ,IIf([Forms]![Default]![st]="All"
  26.                ,[Act]
  27.                ,IIf([Forms]![Default]![st]="Active Accounts"
  28.                   ,1
  29.                   ,[Act])))) 
  30.        AND ((QryAccountsSub.LL)
  31.             =IIf(IsNull([Forms]![Default]![st])
  32.                ,[LL]
  33.                ,IIf([Forms]![Default]![st]="All"
  34.                   ,[LL]
  35.                   ,IIf([Forms]![Default]![st]="Pre-Installed"
  36.                   ,1
  37.                   ,[LL])))))
Here is the subquery:
Expand|Select|Wrap|Line Numbers
  1. SELECT Accounts.*
  2.    , IIf(IsNull([Q Date])
  3.          ,1
  4.          ,0)
  5.     AS QQ
  6.    , IIf(IsNull([Live Date])
  7.          ,1
  8.          ,0) 
  9.     AS LL
  10.    , IIf(IsNull([Q Date]) 
  11.          And [Live Date]<Date()+20
  12.             ,1
  13.             ,0)
  14.     AS Act
  15. FROM Accounts
  16. ORDER BY Accounts.[Account Number];
The combo box is named st and has 4 values: "All";"Pre-Installed";"Q Accounts";"Active Accounts.

Can anyone give me some insight into where/how to change values so that I can change from a combo box to radio buttons? Also, is there any way to simplify this? Thanks!
Aug 23 '14 #1
2 1463
rhonda6373
35 32bit
Hello,

I figured this out. Rather than trying to understand this query, I just replaced the values "All";"Pre-Installed";"Q Accounts";"Active Accounts" in the query with 1,2,3,4 and renamed the radio button frame to st. It appears to work.

Thanks!
Aug 24 '14 #2
zmbd
5,501 Expert Mod 4TB
Sorry, late to the party. (^_^)
Radio controls as set up in a frame control return a numeric value to the frame. This why your 1,2,3,4 worked in the query.
Aug 27 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
2
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as...
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
4
by: Blasting Cap | last post by:
I have a page that has a number of radio buttons that will be displayed to different access levels of a user who logs in to my website. For instance, if there are a dozen buttons, user1 will see...
6
by: yajiv.vijay | last post by:
I am just started using getElementsByTagName. I dont know how to filter radio buttons from all other INPUT fields. Is there any way to do that without looping through all the INPUT fields?
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
7
by: gengyue | last post by:
Hi, I am running a report using Cold Fusion. This report is generated by cfloop tag. Depends on the record count of a query, the report will list the data retrieved from the database. each row in...
11
by: Jody Cliffe | last post by:
Hi. Im trying to program my radio buttons to filter data for student pass/fail in a sub form called I have using help found here got this far but its not working and Im not sure why. my radio...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.