Radio Button multiple selections

S

Sub Guy

Hey, I have a form with 20 individual unbound radio buttons (Options).
What I want to do is allow users to select any one or many of the
option buttons and produce a query or table that will display data relitive
only to the choices they made. The table in question that my current query is
tied to has all 20 elements in it and this does not seem to be the way to go
(Because everthing shows up and the items they do not select just have blank
data). I'm sure there must be some code or a report generator that would
carry out this task.
 
S

Steve Sanford

Please post the SQL of the query and the names or the option buttons.
The names of the fields in the table and their data types would also help.
 
S

Sub Guy

This is fairley basic query structure. What I was trying to do was working,
but like I said, I don't want to see the items I did not select.

SELECT IIf([forms]![FRM_Purchace Master Menu]![option113]=-1,[BUYER],"") AS
[BUYER-], IIf([forms]![FRM_Purchace Master Menu]![option115]=-1,[BUYPART],"")
AS [BUYPART-], IIf([forms]![FRM_Purchace Master
Menu]![option117]=-1,[COGENG],"") AS [COGENG-], IIf([forms]![FRM_Purchace
Master Menu]![option119]=-1,[CSA],"") AS [CSA-], IIf([forms]![FRM_Purchace
Master Menu]![option121]=-1,[DELCDE],"") AS [DELCDE-],
IIf([forms]![FRM_Purchace Master Menu]![option123]=-1,[DESC],"") AS [DESC-],
IIf([forms]![FRM_Purchace Master Menu]![option125]=-1,[DWGREV],"") AS
[DWGREV-], IIf([forms]![FRM_Purchace Master
Menu]![option127]=-1,[DWGSPEC],"") AS [DWGSPEC-], IIf([forms]![FRM_Purchace
Master Menu]![option129]=-1,[ENGCOM],"") AS [ENGCOM-],
IIf([forms]![FRM_Purchace Master Menu]![option131]=-1,[EXCP],"") AS [EXCP-],
IIf([forms]![FRM_Purchace Master Menu]![option133]=-1,[INSPLT],"") AS
[INSPLT-], IIf([forms]![FRM_Purchace Master Menu]![option135]=-1,[INSTAN],"")
AS [INSTAN-], IIf([forms]![FRM_Purchace Master
Menu]![option137]=-1,[ITEM],"") AS [ITEM-], IIf([forms]![FRM_Purchace Master
Menu]![option139]=-1,[Loc],"") AS [Loc-], IIf([forms]![FRM_Purchace Master
Menu]![option141]=-1,[LT],"") AS [LT-], IIf([forms]![FRM_Purchace Master
Menu]![option153]=-1,[METQ],"") AS [METQ-], IIf([forms]![FRM_Purchace Master
Menu]![option155]=-1,[MFLAG],"") AS [MFLAG-], IIf([forms]![FRM_Purchace
Master Menu]![option157]=-1,[MKBUY],"") AS [MKBUY-],
IIf([forms]![FRM_Purchace Master Menu]![option159]=-1,[MLS],"") AS [MLS-],
IIf([forms]![FRM_Purchace Master Menu]![option161]=-1,[MNDINSP],"") AS
[MNDINSP-]
FROM [TBL_EB_CDB Flat File];
 
S

Sub Guy

This is my basic query. But like I said, I did not want to see items I did
not select.

SELECT IIf([forms]![FRM_Purchace Master Menu]![option113]=-1,[BUYER],"") AS
[BUYER-], IIf([forms]![FRM_Purchace Master Menu]![option115]=-1,[BUYPART],"")
AS [BUYPART-], IIf([forms]![FRM_Purchace Master
Menu]![option117]=-1,[COGENG],"") AS [COGENG-], IIf([forms]![FRM_Purchace
Master Menu]![option119]=-1,[CSA],"") AS [CSA-], IIf([forms]![FRM_Purchace
Master Menu]![option121]=-1,[DELCDE],"") AS [DELCDE-],
IIf([forms]![FRM_Purchace Master Menu]![option123]=-1,[DESC],"") AS [DESC-],
IIf([forms]![FRM_Purchace Master Menu]![option125]=-1,[DWGREV],"") AS
[DWGREV-], IIf([forms]![FRM_Purchace Master
Menu]![option127]=-1,[DWGSPEC],"") AS [DWGSPEC-], IIf([forms]![FRM_Purchace
Master Menu]![option129]=-1,[ENGCOM],"") AS [ENGCOM-],
IIf([forms]![FRM_Purchace Master Menu]![option131]=-1,[EXCP],"") AS [EXCP-],
IIf([forms]![FRM_Purchace Master Menu]![option133]=-1,[INSPLT],"") AS
[INSPLT-], IIf([forms]![FRM_Purchace Master Menu]![option135]=-1,[INSTAN],"")
AS [INSTAN-], IIf([forms]![FRM_Purchace Master
Menu]![option137]=-1,[ITEM],"") AS [ITEM-], IIf([forms]![FRM_Purchace Master
Menu]![option139]=-1,[Loc],"") AS [Loc-], IIf([forms]![FRM_Purchace Master
Menu]![option141]=-1,[LT],"") AS [LT-], IIf([forms]![FRM_Purchace Master
Menu]![option153]=-1,[METQ],"") AS [METQ-], IIf([forms]![FRM_Purchace Master
Menu]![option155]=-1,[MFLAG],"") AS [MFLAG-], IIf([forms]![FRM_Purchace
Master Menu]![option157]=-1,[MKBUY],"") AS [MKBUY-],
IIf([forms]![FRM_Purchace Master Menu]![option159]=-1,[MLS],"") AS [MLS-],
IIf([forms]![FRM_Purchace Master Menu]![option161]=-1,[MNDINSP],"") AS
[MNDINSP-]
FROM [TBL_EB_CDB Flat File];
 
S

Steve Sanford

What is it you are trying to do?? Right now, your query says "Show me all of
the fields in the table, but inly show the data is the corresponding radio
button is selected (TRUE).

If you are trying to limit the number of fields displayed, you need to
change the query def to select only the fields you want to see.

So if you have a form named "MyFormName", with the record source a query
named "qryEB_CDB", I would have a button that would change the query def,
then open the form.

To change the fields displayed, you would close the forl, reselect the
option buttons then open the form again by clicking on the button.

Here is the (--untested--) code:

'************ Code Start **********
Private Sub btnTestQuery_Click()

Dim sSQL As String
Dim loqd As QueryDef

sSQL = ""

If [Forms]![FRM_Purchace Master Menu]![option113] = True Then
sSQL = sSQL & " [BUYER] AS [BUYER-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option115] = True Then
sSQL = sSQL & " [BUYPART] AS [BUYPART-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option117] = True Then
sSQL = sSQL & " [COGENG] AS [COGENG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option119] = True Then
sSQL = sSQL & " [CSA] AS [CSA-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option121] = True Then
sSQL = sSQL & " [DELCDE] AS [DELCDE-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option123] = True Then
sSQL = sSQL & " [DESC] AS [DESC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option125] = True Then
sSQL = sSQL & " [DWGREV] AS [DWGREV-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option127] = True Then
sSQL = sSQL & " [DWGSPEC] AS [DWGSPEC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option129] = True Then
sSQL = sSQL & " [ENGCOM] AS [ENGCOM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option131] = True Then
sSQL = sSQL & " [EXCP] AS [EXCP-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option133] = True Then
sSQL = sSQL & " [INSPLT] AS [INSPLT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option135] = True Then
sSQL = sSQL & " [INSTAN] AS [INSTAN-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option137] = True Then
sSQL = sSQL & " [ITEM] AS [ITEM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option139] = True Then
sSQL = sSQL & " [Loc] AS [Loc-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option141] = True Then
sSQL = sSQL & " [LT] AS [LT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option153] = True Then
sSQL = sSQL & " [METQ] AS [METQ-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option155] = True Then
sSQL = sSQL & " [MFLAG] AS [MFLAG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option157] = True Then
sSQL = sSQL & " [MKBUY] AS [MKBUY-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option159] = True Then
sSQL = sSQL & " [MLS] AS [MLS-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option161] = True Then
sSQL = sSQL & " [MNDINSP] As [MNDINSP-],"
End If
sSQL = trlm(sSQL)

' Debug.Print sSQL

If Len(sSQL) > 3 Then
sSQL = Left(sSQL, Len(sSQL) - 1)

' -----------Change the query name---------
Set loqd = CurrentDb.QueryDefs("qryEB_CDB")

stSQL = "SELECT" & sSQL
stSQL = stSQL & " FROM [TBL_EB_CDB Flat File];"

loqd.SQL = stSQL
loqd.Close
End If

' -----------Change the form name---------
DoCmd.OpenForm "MyFormName"

End Sub
'************ Code End **********

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Sub Guy said:
This is my basic query. But like I said, I did not want to see items I did
not select.

SELECT IIf([forms]![FRM_Purchace Master Menu]![option113]=-1,[BUYER],"") AS
[BUYER-], IIf([forms]![FRM_Purchace Master Menu]![option115]=-1,[BUYPART],"")
AS [BUYPART-], IIf([forms]![FRM_Purchace Master
Menu]![option117]=-1,[COGENG],"") AS [COGENG-], IIf([forms]![FRM_Purchace
Master Menu]![option119]=-1,[CSA],"") AS [CSA-], IIf([forms]![FRM_Purchace
Master Menu]![option121]=-1,[DELCDE],"") AS [DELCDE-],
IIf([forms]![FRM_Purchace Master Menu]![option123]=-1,[DESC],"") AS [DESC-],
IIf([forms]![FRM_Purchace Master Menu]![option125]=-1,[DWGREV],"") AS
[DWGREV-], IIf([forms]![FRM_Purchace Master
Menu]![option127]=-1,[DWGSPEC],"") AS [DWGSPEC-], IIf([forms]![FRM_Purchace
Master Menu]![option129]=-1,[ENGCOM],"") AS [ENGCOM-],
IIf([forms]![FRM_Purchace Master Menu]![option131]=-1,[EXCP],"") AS [EXCP-],
IIf([forms]![FRM_Purchace Master Menu]![option133]=-1,[INSPLT],"") AS
[INSPLT-], IIf([forms]![FRM_Purchace Master Menu]![option135]=-1,[INSTAN],"")
AS [INSTAN-], IIf([forms]![FRM_Purchace Master
Menu]![option137]=-1,[ITEM],"") AS [ITEM-], IIf([forms]![FRM_Purchace Master
Menu]![option139]=-1,[Loc],"") AS [Loc-], IIf([forms]![FRM_Purchace Master
Menu]![option141]=-1,[LT],"") AS [LT-], IIf([forms]![FRM_Purchace Master
Menu]![option153]=-1,[METQ],"") AS [METQ-], IIf([forms]![FRM_Purchace Master
Menu]![option155]=-1,[MFLAG],"") AS [MFLAG-], IIf([forms]![FRM_Purchace
Master Menu]![option157]=-1,[MKBUY],"") AS [MKBUY-],
IIf([forms]![FRM_Purchace Master Menu]![option159]=-1,[MLS],"") AS [MLS-],
IIf([forms]![FRM_Purchace Master Menu]![option161]=-1,[MNDINSP],"") AS
[MNDINSP-]
FROM [TBL_EB_CDB Flat File];

--
NGNN Submarines (Mark)


Steve Sanford said:
Please post the SQL of the query and the names or the option buttons.
The names of the fields in the table and their data types would also help.
 
S

Sub Guy

Problem with internet connection
--
NGNN Submarines (Mark)


Steve Sanford said:
What is it you are trying to do?? Right now, your query says "Show me all of
the fields in the table, but inly show the data is the corresponding radio
button is selected (TRUE).

If you are trying to limit the number of fields displayed, you need to
change the query def to select only the fields you want to see.

So if you have a form named "MyFormName", with the record source a query
named "qryEB_CDB", I would have a button that would change the query def,
then open the form.

To change the fields displayed, you would close the forl, reselect the
option buttons then open the form again by clicking on the button.

Here is the (--untested--) code:

'************ Code Start **********
Private Sub btnTestQuery_Click()

Dim sSQL As String
Dim loqd As QueryDef

sSQL = ""

If [Forms]![FRM_Purchace Master Menu]![option113] = True Then
sSQL = sSQL & " [BUYER] AS [BUYER-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option115] = True Then
sSQL = sSQL & " [BUYPART] AS [BUYPART-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option117] = True Then
sSQL = sSQL & " [COGENG] AS [COGENG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option119] = True Then
sSQL = sSQL & " [CSA] AS [CSA-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option121] = True Then
sSQL = sSQL & " [DELCDE] AS [DELCDE-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option123] = True Then
sSQL = sSQL & " [DESC] AS [DESC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option125] = True Then
sSQL = sSQL & " [DWGREV] AS [DWGREV-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option127] = True Then
sSQL = sSQL & " [DWGSPEC] AS [DWGSPEC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option129] = True Then
sSQL = sSQL & " [ENGCOM] AS [ENGCOM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option131] = True Then
sSQL = sSQL & " [EXCP] AS [EXCP-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option133] = True Then
sSQL = sSQL & " [INSPLT] AS [INSPLT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option135] = True Then
sSQL = sSQL & " [INSTAN] AS [INSTAN-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option137] = True Then
sSQL = sSQL & " [ITEM] AS [ITEM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option139] = True Then
sSQL = sSQL & " [Loc] AS [Loc-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option141] = True Then
sSQL = sSQL & " [LT] AS [LT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option153] = True Then
sSQL = sSQL & " [METQ] AS [METQ-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option155] = True Then
sSQL = sSQL & " [MFLAG] AS [MFLAG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option157] = True Then
sSQL = sSQL & " [MKBUY] AS [MKBUY-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option159] = True Then
sSQL = sSQL & " [MLS] AS [MLS-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option161] = True Then
sSQL = sSQL & " [MNDINSP] As [MNDINSP-],"
End If
sSQL = trlm(sSQL)

' Debug.Print sSQL

If Len(sSQL) > 3 Then
sSQL = Left(sSQL, Len(sSQL) - 1)

' -----------Change the query name---------
Set loqd = CurrentDb.QueryDefs("qryEB_CDB")

stSQL = "SELECT" & sSQL
stSQL = stSQL & " FROM [TBL_EB_CDB Flat File];"

loqd.SQL = stSQL
loqd.Close
End If

' -----------Change the form name---------
DoCmd.OpenForm "MyFormName"

End Sub
'************ Code End **********

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Sub Guy said:
This is my basic query. But like I said, I did not want to see items I did
not select.

SELECT IIf([forms]![FRM_Purchace Master Menu]![option113]=-1,[BUYER],"") AS
[BUYER-], IIf([forms]![FRM_Purchace Master Menu]![option115]=-1,[BUYPART],"")
AS [BUYPART-], IIf([forms]![FRM_Purchace Master
Menu]![option117]=-1,[COGENG],"") AS [COGENG-], IIf([forms]![FRM_Purchace
Master Menu]![option119]=-1,[CSA],"") AS [CSA-], IIf([forms]![FRM_Purchace
Master Menu]![option121]=-1,[DELCDE],"") AS [DELCDE-],
IIf([forms]![FRM_Purchace Master Menu]![option123]=-1,[DESC],"") AS [DESC-],
IIf([forms]![FRM_Purchace Master Menu]![option125]=-1,[DWGREV],"") AS
[DWGREV-], IIf([forms]![FRM_Purchace Master
Menu]![option127]=-1,[DWGSPEC],"") AS [DWGSPEC-], IIf([forms]![FRM_Purchace
Master Menu]![option129]=-1,[ENGCOM],"") AS [ENGCOM-],
IIf([forms]![FRM_Purchace Master Menu]![option131]=-1,[EXCP],"") AS [EXCP-],
IIf([forms]![FRM_Purchace Master Menu]![option133]=-1,[INSPLT],"") AS
[INSPLT-], IIf([forms]![FRM_Purchace Master Menu]![option135]=-1,[INSTAN],"")
AS [INSTAN-], IIf([forms]![FRM_Purchace Master
Menu]![option137]=-1,[ITEM],"") AS [ITEM-], IIf([forms]![FRM_Purchace Master
Menu]![option139]=-1,[Loc],"") AS [Loc-], IIf([forms]![FRM_Purchace Master
Menu]![option141]=-1,[LT],"") AS [LT-], IIf([forms]![FRM_Purchace Master
Menu]![option153]=-1,[METQ],"") AS [METQ-], IIf([forms]![FRM_Purchace Master
Menu]![option155]=-1,[MFLAG],"") AS [MFLAG-], IIf([forms]![FRM_Purchace
Master Menu]![option157]=-1,[MKBUY],"") AS [MKBUY-],
IIf([forms]![FRM_Purchace Master Menu]![option159]=-1,[MLS],"") AS [MLS-],
IIf([forms]![FRM_Purchace Master Menu]![option161]=-1,[MNDINSP],"") AS
[MNDINSP-]
FROM [TBL_EB_CDB Flat File];

--
NGNN Submarines (Mark)


Steve Sanford said:
Please post the SQL of the query and the names or the option buttons.
The names of the fields in the table and their data types would also help.
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

Hey, I have a form with 20 individual unbound radio buttons (Options).
What I want to do is allow users to select any one or many of the
option buttons and produce a query or table that will display data relitive
only to the choices they made. The table in question that my current query is
tied to has all 20 elements in it and this does not seem to be the way to go
(Because everthing shows up and the items they do not select just have blank
data). I'm sure there must be some code or a report generator that would
carry out this task.
 
S

Sub Guy

What I am trying to do is come up with a way to allow users to utilize a form
with 20 radio buttons that allows them to generate a query style result with
a multiple chioce selection ability. Maybe this is not the way to go. I am
not following your suggestions about changing the query definitions and when
they would be changed. It looks like what you have would work, I'm just
having trouble applying it.
--
NGNN Submarines (Mark)


Steve Sanford said:
What is it you are trying to do?? Right now, your query says "Show me all of
the fields in the table, but inly show the data is the corresponding radio
button is selected (TRUE).

If you are trying to limit the number of fields displayed, you need to
change the query def to select only the fields you want to see.

So if you have a form named "MyFormName", with the record source a query
named "qryEB_CDB", I would have a button that would change the query def,
then open the form.

To change the fields displayed, you would close the forl, reselect the
option buttons then open the form again by clicking on the button.

Here is the (--untested--) code:

'************ Code Start **********
Private Sub btnTestQuery_Click()

Dim sSQL As String
Dim loqd As QueryDef

sSQL = ""

If [Forms]![FRM_Purchace Master Menu]![option113] = True Then
sSQL = sSQL & " [BUYER] AS [BUYER-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option115] = True Then
sSQL = sSQL & " [BUYPART] AS [BUYPART-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option117] = True Then
sSQL = sSQL & " [COGENG] AS [COGENG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option119] = True Then
sSQL = sSQL & " [CSA] AS [CSA-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option121] = True Then
sSQL = sSQL & " [DELCDE] AS [DELCDE-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option123] = True Then
sSQL = sSQL & " [DESC] AS [DESC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option125] = True Then
sSQL = sSQL & " [DWGREV] AS [DWGREV-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option127] = True Then
sSQL = sSQL & " [DWGSPEC] AS [DWGSPEC-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option129] = True Then
sSQL = sSQL & " [ENGCOM] AS [ENGCOM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option131] = True Then
sSQL = sSQL & " [EXCP] AS [EXCP-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option133] = True Then
sSQL = sSQL & " [INSPLT] AS [INSPLT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option135] = True Then
sSQL = sSQL & " [INSTAN] AS [INSTAN-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option137] = True Then
sSQL = sSQL & " [ITEM] AS [ITEM-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option139] = True Then
sSQL = sSQL & " [Loc] AS [Loc-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option141] = True Then
sSQL = sSQL & " [LT] AS [LT-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option153] = True Then
sSQL = sSQL & " [METQ] AS [METQ-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option155] = True Then
sSQL = sSQL & " [MFLAG] AS [MFLAG-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option157] = True Then
sSQL = sSQL & " [MKBUY] AS [MKBUY-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option159] = True Then
sSQL = sSQL & " [MLS] AS [MLS-],"
End If
If [Forms]![FRM_Purchace Master Menu]![option161] = True Then
sSQL = sSQL & " [MNDINSP] As [MNDINSP-],"
End If
sSQL = trlm(sSQL)

' Debug.Print sSQL

If Len(sSQL) > 3 Then
sSQL = Left(sSQL, Len(sSQL) - 1)

' -----------Change the query name---------
Set loqd = CurrentDb.QueryDefs("qryEB_CDB")

stSQL = "SELECT" & sSQL
stSQL = stSQL & " FROM [TBL_EB_CDB Flat File];"

loqd.SQL = stSQL
loqd.Close
End If

' -----------Change the form name---------
DoCmd.OpenForm "MyFormName"

End Sub
'************ Code End **********

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Sub Guy said:
This is my basic query. But like I said, I did not want to see items I did
not select.

SELECT IIf([forms]![FRM_Purchace Master Menu]![option113]=-1,[BUYER],"") AS
[BUYER-], IIf([forms]![FRM_Purchace Master Menu]![option115]=-1,[BUYPART],"")
AS [BUYPART-], IIf([forms]![FRM_Purchace Master
Menu]![option117]=-1,[COGENG],"") AS [COGENG-], IIf([forms]![FRM_Purchace
Master Menu]![option119]=-1,[CSA],"") AS [CSA-], IIf([forms]![FRM_Purchace
Master Menu]![option121]=-1,[DELCDE],"") AS [DELCDE-],
IIf([forms]![FRM_Purchace Master Menu]![option123]=-1,[DESC],"") AS [DESC-],
IIf([forms]![FRM_Purchace Master Menu]![option125]=-1,[DWGREV],"") AS
[DWGREV-], IIf([forms]![FRM_Purchace Master
Menu]![option127]=-1,[DWGSPEC],"") AS [DWGSPEC-], IIf([forms]![FRM_Purchace
Master Menu]![option129]=-1,[ENGCOM],"") AS [ENGCOM-],
IIf([forms]![FRM_Purchace Master Menu]![option131]=-1,[EXCP],"") AS [EXCP-],
IIf([forms]![FRM_Purchace Master Menu]![option133]=-1,[INSPLT],"") AS
[INSPLT-], IIf([forms]![FRM_Purchace Master Menu]![option135]=-1,[INSTAN],"")
AS [INSTAN-], IIf([forms]![FRM_Purchace Master
Menu]![option137]=-1,[ITEM],"") AS [ITEM-], IIf([forms]![FRM_Purchace Master
Menu]![option139]=-1,[Loc],"") AS [Loc-], IIf([forms]![FRM_Purchace Master
Menu]![option141]=-1,[LT],"") AS [LT-], IIf([forms]![FRM_Purchace Master
Menu]![option153]=-1,[METQ],"") AS [METQ-], IIf([forms]![FRM_Purchace Master
Menu]![option155]=-1,[MFLAG],"") AS [MFLAG-], IIf([forms]![FRM_Purchace
Master Menu]![option157]=-1,[MKBUY],"") AS [MKBUY-],
IIf([forms]![FRM_Purchace Master Menu]![option159]=-1,[MLS],"") AS [MLS-],
IIf([forms]![FRM_Purchace Master Menu]![option161]=-1,[MNDINSP],"") AS
[MNDINSP-]
FROM [TBL_EB_CDB Flat File];

--
NGNN Submarines (Mark)


Steve Sanford said:
Please post the SQL of the query and the names or the option buttons.
The names of the fields in the table and their data types would also help.
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

Hey, I have a form with 20 individual unbound radio buttons (Options).
What I want to do is allow users to select any one or many of the
option buttons and produce a query or table that will display data relitive
only to the choices they made. The table in question that my current query is
tied to has all 20 elements in it and this does not seem to be the way to go
(Because everthing shows up and the items they do not select just have blank
data). I'm sure there must be some code or a report generator that would
carry out this task.
 
S

Sub Guy

IT WORKED................
I thank you very much (Steve) for the code that made this work.
--
NGNN Submarines (Mark)


BruceM via AccessMonster.com said:
What you seem to be talking about is a query with a variable number of fields.
I believe this is the idea behind using QueryDef, but I am not very familiar
with that procedure, so I will not try to comment further just now, except to
say I may have missed something.

However, I will say that you probably need to open the query directly rather
than the form, as the form will be looking for the Record Source values for
bound controls. Either that or you will somehow have to build a form
dynamically, using only the fields in the resulting recordset. It may be
possible, but I can't begin to describe how.

It seems rather a curious thing that the user cannot limit the number of
records in the recordset, but rather would be able to restrict the fields in
the recordset. Typically the user would be able to limit records to those
for a specific [BUYER] (or several buyers, with a multi-select list box), for
instance.

In any case, I don't see that anything is gained by using an alias for each
field. Probably no harm either, but quite a bit of extra typing for the code.


If the code is in FRM_Purchace Master Menu, you could use something like:

If Me.[option113] = True

Again, saves a lot of typing, and is probably more efficient.

Also, you will be doing yourself a favor if you name the option groups and
other controls with meaningful names (optBuyer, for instance).

Sub said:
What I am trying to do is come up with a way to allow users to utilize a form
with 20 radio buttons that allows them to generate a query style result with
a multiple chioce selection ability. Maybe this is not the way to go. I am
not following your suggestions about changing the query definitions and when
they would be changed. It looks like what you have would work, I'm just
having trouble applying it.
What is it you are trying to do?? Right now, your query says "Show me all of
the fields in the table, but inly show the data is the corresponding radio
[quoted text clipped - 145 lines]
data). I'm sure there must be some code or a report generator that would
carry out this task.
 

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