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 |
#1
|
|||
|
|||
combobox filter
Hi everybody
My problem is about combo box filters. I have two combo boxes one is for main category and one is for sub category. When you choose the main ctg. from the first combo, the second combo box shows the sub categories belonging to that main ctg. i'm ok with that. When i use this in subform it works for the first line. When i go to the second line and choose a diffrent main category, the sub category on the first line is erased, i mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. Is there a solution for that. Thank you in advance and regards. NOTE : Main ctg table fields(main_ctg_id;main ctg) Sub ctg table fields(sub_ctg_id;sub_ctg;main_ctg_id (as foreign key)) In sub ctg. combo box query, i add a criteria to main_ctg_id as the main ctg. combo control name on that form. |
#2
|
|||
|
|||
combobox filter
snip
mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. You need to do a requery of the subcategory combobox in the onchange event of the main category. HTH Marc |
#3
|
|||
|
|||
combobox filter
Do you use a Form in ContinuousFormView as the Subform?
If you do, that's the problem since what you see is many instances of the the *same* ComboBox Control and since it is the same Control, you can only have 1 RowSource. Thus, all instances will have the same RowSource. If the value of the ComboBox in the first row is no longer in the RowSource, the ComboBox instance in the first row will show blank (the value is still there). What you can do is to create 2 ComboBox Controls (or a TextBox and the filtered ComboBox) occupying the same space, one is dynamically filtered according to the main category, one is unfiltered which has all sub-categories in the RowSource. Bring the unfiltered ComboBox to Front of the filtered ComboBox. Bind both ComboBox to the same required Field in your (Subform's) RecordSource. Add the code in the GotFocus Event of the unfiltered ComboBox to send the Focus to the filtered ComboBox. This way, the instances of the unfiltered ComboBox always shows the chosen values (since all values are in the RowSource). In the current row (for current data entry, says), when the user move to the Focus to the unfiltered ComboBox, the filtered ComboBox will get the Focus (it will come to the front covering the unfiltered ComboBox) which has only filtered choices. You can even drop the list down (DropDown Method) automatically for the use to select. -- HTH Van T. Dinh MVP (Access) "AliKural" wrote in message ... Hi everybody My problem is about combo box filters. I have two combo boxes one is for main category and one is for sub category. When you choose the main ctg. from the first combo, the second combo box shows the sub categories belonging to that main ctg. i'm ok with that. When i use this in subform it works for the first line. When i go to the second line and choose a diffrent main category, the sub category on the first line is erased, i mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. Is there a solution for that. Thank you in advance and regards. NOTE : Main ctg table fields(main_ctg_id;main ctg) Sub ctg table fields(sub_ctg_id;sub_ctg;main_ctg_id (as foreign key)) In sub ctg. combo box query, i add a criteria to main_ctg_id as the main ctg. combo control name on that form. |
#4
|
|||
|
|||
combobox filter
In fact i have a code on "Afterupdate" event of the main
category combo ctrl., which requeries the sub ctg. combo box control, but it doesn't work. I mean in the second line of subform (where the subform is in datasheet view) if i have the same main category as the first line it works, but if i change the main category, the sub category on the first line becomes invisible. Thx for reply. -----Original Message----- snip mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. You need to do a requery of the subcategory combobox in the onchange event of the main category. HTH Marc . |
#5
|
|||
|
|||
combobox filter
Thx for the idea, i think i got your point with that, but
the subform is in datasheet view, so both controls will show as diffrent columns. I can design the subform in continuous view, but i still wonder if there is a way to show the values in datasheet view. I got to this point cause i had the same problem in the main form, but i added refreshpage macro to afterupdate event of the main ctg. and the problem was solved. Thank you in regard. -----Original Message----- Do you use a Form in ContinuousFormView as the Subform? If you do, that's the problem since what you see is many instances of the the *same* ComboBox Control and since it is the same Control, you can only have 1 RowSource. Thus, all instances will have the same RowSource. If the value of the ComboBox in the first row is no longer in the RowSource, the ComboBox instance in the first row will show blank (the value is still there). What you can do is to create 2 ComboBox Controls (or a TextBox and the filtered ComboBox) occupying the same space, one is dynamically filtered according to the main category, one is unfiltered which has all sub-categories in the RowSource. Bring the unfiltered ComboBox to Front of the filtered ComboBox. Bind both ComboBox to the same required Field in your (Subform's) RecordSource. Add the code in the GotFocus Event of the unfiltered ComboBox to send the Focus to the filtered ComboBox. This way, the instances of the unfiltered ComboBox always shows the chosen values (since all values are in the RowSource). In the current row (for current data entry, says), when the user move to the Focus to the unfiltered ComboBox, the filtered ComboBox will get the Focus (it will come to the front covering the unfiltered ComboBox) which has only filtered choices. You can even drop the list down (DropDown Method) automatically for the use to select. -- HTH Van T. Dinh MVP (Access) "AliKural" wrote in message ... Hi everybody My problem is about combo box filters. I have two combo boxes one is for main category and one is for sub category. When you choose the main ctg. from the first combo, the second combo box shows the sub categories belonging to that main ctg. i'm ok with that. When i use this in subform it works for the first line. When i go to the second line and choose a diffrent main category, the sub category on the first line is erased, i mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. Is there a solution for that. Thank you in advance and regards. NOTE : Main ctg table fields(main_ctg_id;main ctg) Sub ctg table fields (sub_ctg_id;sub_ctg;main_ctg_id (as foreign key)) In sub ctg. combo box query, i add a criteria to main_ctg_id as the main ctg. combo control name on that form. . |
#6
|
|||
|
|||
combobox filter
Have you tried it in the onchange?
Marc "AliKural" wrote in message ... In fact i have a code on "Afterupdate" event of the main category combo ctrl., which requeries the sub ctg. combo box control, but it doesn't work. I mean in the second line of subform (where the subform is in datasheet view) if i have the same main category as the first line it works, but if i change the main category, the sub category on the first line becomes invisible. Thx for reply. -----Original Message----- snip mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. You need to do a requery of the subcategory combobox in the onchange event of the main category. HTH Marc . |
#7
|
|||
|
|||
combobox filter
Not sure about DatasheetView of the Subform. I always use CtsFormView which
can be designed to look like a Datasheet. -- HTH Van T. Dinh MVP (Access) "AliKural" wrote in message ... Thx for the idea, i think i got your point with that, but the subform is in datasheet view, so both controls will show as diffrent columns. I can design the subform in continuous view, but i still wonder if there is a way to show the values in datasheet view. I got to this point cause i had the same problem in the main form, but i added refreshpage macro to afterupdate event of the main ctg. and the problem was solved. Thank you in regard. -----Original Message----- Do you use a Form in ContinuousFormView as the Subform? If you do, that's the problem since what you see is many instances of the the *same* ComboBox Control and since it is the same Control, you can only have 1 RowSource. Thus, all instances will have the same RowSource. If the value of the ComboBox in the first row is no longer in the RowSource, the ComboBox instance in the first row will show blank (the value is still there). What you can do is to create 2 ComboBox Controls (or a TextBox and the filtered ComboBox) occupying the same space, one is dynamically filtered according to the main category, one is unfiltered which has all sub-categories in the RowSource. Bring the unfiltered ComboBox to Front of the filtered ComboBox. Bind both ComboBox to the same required Field in your (Subform's) RecordSource. Add the code in the GotFocus Event of the unfiltered ComboBox to send the Focus to the filtered ComboBox. This way, the instances of the unfiltered ComboBox always shows the chosen values (since all values are in the RowSource). In the current row (for current data entry, says), when the user move to the Focus to the unfiltered ComboBox, the filtered ComboBox will get the Focus (it will come to the front covering the unfiltered ComboBox) which has only filtered choices. You can even drop the list down (DropDown Method) automatically for the use to select. -- HTH Van T. Dinh MVP (Access) "AliKural" wrote in message ... Hi everybody My problem is about combo box filters. I have two combo boxes one is for main category and one is for sub category. When you choose the main ctg. from the first combo, the second combo box shows the sub categories belonging to that main ctg. i'm ok with that. When i use this in subform it works for the first line. When i go to the second line and choose a diffrent main category, the sub category on the first line is erased, i mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. Is there a solution for that. Thank you in advance and regards. NOTE : Main ctg table fields(main_ctg_id;main ctg) Sub ctg table fields (sub_ctg_id;sub_ctg;main_ctg_id (as foreign key)) In sub ctg. combo box query, i add a criteria to main_ctg_id as the main ctg. combo control name on that form. . |
#8
|
|||
|
|||
combobox filter
Yes i tried, it didn't work either.
-----Original Message----- Have you tried it in the onchange? Marc "AliKural" wrote in message ... In fact i have a code on "Afterupdate" event of the main category combo ctrl., which requeries the sub ctg. combo box control, but it doesn't work. I mean in the second line of subform (where the subform is in datasheet view) if i have the same main category as the first line it works, but if i change the main category, the sub category on the first line becomes invisible. Thx for reply. -----Original Message----- snip mean not from the table, but from the screen. I tried refreshpage on main forms it worked, but in the subform it didn't. You need to do a requery of the subcategory combobox in the onchange event of the main category. HTH Marc . . |
Thread Tools | |
Display Modes | |
|
|