If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Form: Combo selection with "ALL"
Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is
selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
#12
|
|||
|
|||
Form: Combo selection with "ALL"
Untested, but see if this helps:
WHERE xA_rt_CC_Site.Site Like IIf([Forms]![x_FormA]![Site] = "(ALL)", "*", [Forms]![x_FormA]![Site]) "MSA" wrote: Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
#13
|
|||
|
|||
Form: Combo selection with "ALL"
Hi Klatuu,
First sorry for the delayed response as I had been away. YES! the 2nd code is working as well - thanks once again for your help and patience. One last request is it possible to have an ALL option, in the 2nd combo drop down list. If so what do I need to add. Thanks in advance! MSA "Klatuu" wrote: Untested, but see if this helps: WHERE xA_rt_CC_Site.Site Like IIf([Forms]![x_FormA]![Site] = "(ALL)", "*", [Forms]![x_FormA]![Site]) "MSA" wrote: Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
#14
|
|||
|
|||
Form: Combo selection with "ALL"
There is no reason you can't have the All option in the second combo. You
would do it just like you are doing for the first one. The only difference is you will have to set up the filtering to include both combos. "MSA" wrote: Hi Klatuu, First sorry for the delayed response as I had been away. YES! the 2nd code is working as well - thanks once again for your help and patience. One last request is it possible to have an ALL option, in the 2nd combo drop down list. If so what do I need to add. Thanks in advance! MSA "Klatuu" wrote: Untested, but see if this helps: WHERE xA_rt_CC_Site.Site Like IIf([Forms]![x_FormA]![Site] = "(ALL)", "*", [Forms]![x_FormA]![Site]) "MSA" wrote: Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
#15
|
|||
|
|||
Form: Combo selection with "ALL"
Hi Klatuu,
I tried as advised. Following is my code in the second combo: SELECT A_rt_Site_Grp_CC.SGID, A_rt_Site_Grp_CC.SiteGroupID, A_rt_Site_Grp_CC.Site FROM A_rt_Site_Grp_CC UNION Select Null as AllChoice, "(All)"as Bogus From A_rt_Site_Grp_CC WHERE (((A_rt_Site_Grp_CC.Site) Like IIf([Forms]![a_F_01]![Site]="(ALL)","*",[Forms]![a_F_01]![Site]))); When I try that I get the following error msg: The no. of columns in the two selected tables or queries of a union query do not match. Once again thanks for your guidance. MSA "Klatuu" wrote: There is no reason you can't have the All option in the second combo. You would do it just like you are doing for the first one. The only difference is you will have to set up the filtering to include both combos. "MSA" wrote: Hi Klatuu, First sorry for the delayed response as I had been away. YES! the 2nd code is working as well - thanks once again for your help and patience. One last request is it possible to have an ALL option, in the 2nd combo drop down list. If so what do I need to add. Thanks in advance! MSA "Klatuu" wrote: Untested, but see if this helps: WHERE xA_rt_CC_Site.Site Like IIf([Forms]![x_FormA]![Site] = "(ALL)", "*", [Forms]![x_FormA]![Site]) "MSA" wrote: Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
#16
|
|||
|
|||
Form: Combo selection with "ALL"
All Union queries must have the same number of columns from both recordsets.
Just add another column to the All side. UNION Select Null As AnyChoice, Null as AllChoice, "(All)"as Bogus From , A_rt_Site_Grp_CC "MSA" wrote: Hi Klatuu, I tried as advised. Following is my code in the second combo: SELECT A_rt_Site_Grp_CC.SGID, A_rt_Site_Grp_CC.SiteGroupID, A_rt_Site_Grp_CC.Site FROM A_rt_Site_Grp_CC UNION Select Null as AllChoice, "(All)"as Bogus From A_rt_Site_Grp_CC WHERE (((A_rt_Site_Grp_CC.Site) Like IIf([Forms]![a_F_01]![Site]="(ALL)","*",[Forms]![a_F_01]![Site]))); When I try that I get the following error msg: The no. of columns in the two selected tables or queries of a union query do not match. Once again thanks for your guidance. MSA "Klatuu" wrote: There is no reason you can't have the All option in the second combo. You would do it just like you are doing for the first one. The only difference is you will have to set up the filtering to include both combos. "MSA" wrote: Hi Klatuu, First sorry for the delayed response as I had been away. YES! the 2nd code is working as well - thanks once again for your help and patience. One last request is it possible to have an ALL option, in the 2nd combo drop down list. If so what do I need to add. Thanks in advance! MSA "Klatuu" wrote: Untested, but see if this helps: WHERE xA_rt_CC_Site.Site Like IIf([Forms]![x_FormA]![Site] = "(ALL)", "*", [Forms]![x_FormA]![Site]) "MSA" wrote: Thanks it works!. When I now go to my 2nd combo its list is empty if (All) is selected in the 1st combo. What I need is that it should now show all the gropus in the list for 2nd one. Comes the tricky bit, i.e. 2nd Combo box which is based on the 1st combo selection gives the groups. The SQL for the 2nd one is as follow: SELECT xA_rt_CC_Site.SGID, xA_rt_CC_Site.SiteGroupID, xA_rt_CC_Site.Site FROM xA_rt_CC_Site WHERE (((xA_rt_CC_Site.Site)=[Forms]![x_FormA]![Site])) ORDER BY xA_rt_CC_Site.SGID; Once again thanks for your help! MSA "Klatuu" wrote: The SQL used for this type of query is a Union query. A Union query required the same number of fields in both tables. Since you have only one field in your the first select, you can have only one field in the second select. Change it to: UNION Select "(All)"as Bogus From xA_rt_CC_Site Here is the code from one of my forms: SELECT EmployeeNum FROM tbllkEmployee UNION Select "(All)" as Bogus From tbllkEmployee; "MSA" wrote: Thx, yes I did and it did not work. Here is my original SQL statement for the 1st combo box. SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; and the one I tried: SELECT xA_rt_CC_Site.Site FROM xA_rt_CC_Site UNION Select Null as AllChoice , "(All)"as Bogus From xA_rt_CC_Site GROUP BY xA_rt_CC_Site.Site; I kep get an error msg: The number of columns in the two selected tables or queries of a union query do not match First off I have only one column and one table or query - all I need is the combination of the rows of that coumn together (all sites). Sorry for the inconvenience, thx. MSA "Klatuu" wrote: You didn't read the whole page at the site. The large print in the upper portion describes that. Now, you may be thinking that doesn't apply to you because you are using a query. Open the query in design view, switch to SQL view, copy and paste it into the Row Source property of the combo, and modify it to include the code to add the ALL to your list. "MSA" wrote: Hi Klatuu, Thx for your input. Unfortunately I am using - RowSourceType = Table/Query So the suggested approach at the site is dealing with RowSourceType = Value List. Please do advise in this case how to proceed with "All". Thanks! MSA "Klatuu" wrote: This site has the info you need: http://www.mvps.org/access/forms/frm0043.htm "MSA" wrote: I have a Db with a form that reads the data table. On the form I have two combo box that feeds the other combo box. What I need now is to have All as options for the two. To clarify, here is the example: The 1st combo box selects - Sites i.e. NY, Boston, London Within each site there are a number of groups, so the e.g. NY has G1, G2 Boston has G3, G4 London G5 Now the 2nd Combo box based on the site location, gives you the options for that site i.e. If you selected NY, it gives you G1 and G2 selections. Now what I need is to add an option to both combo boxes "All" i.e. Combo1 = All (should give all the 3 sites) Combo2 = All (should give all the groups) Could anyone give me directions, how to go about adding this "All" option to the combo boxes on the form. Thanks in advance for your assistance. MSA |
|
Thread Tools | |
Display Modes | |
|
|