98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access Training and help » Subform / combo box
Subform / combo box
Resolved · High Priority · Version 2003
Neal has attended:
Access Advanced course
Subform / combo box
Hi
I have a combo box that selects the country data from my table and opens a form. In the form the country data is shown in a subform. I now want to add a combo box to the form that filters the sub form data so that I only view the data for a selected town
Help
Thanks
RE: subform / combo box
Hi Neal, note that I am delegate not a tutor but feel sure I can help.
Firstly I don't understand your first sentence. So if my guessed solutions below are not what you need then you can reply with more information such as, is your subform based directly on a table, a query or a form?
You can add a combo box into the subform and select the wizard option 'Find a record on my form based on the value I selected in my combo box'. Then select the town field and complete. You can then select from the drop down list or type in the town. You need to click out of the box for it to go. I like adding a small save or refresh button next to the drop down and put text on it saying 'Go' to make this intuitive.
Another solution if you don't mind re-inserting the subform is to choose to make the subform match a value on the main form (during the creation with the Wizard). If town is a natural ingredient of the main form and the main form is single (one record per form) then the subform will automatically go the correct town without any need to select from a combo box. Other solutions I can give depend on what the main form is based on, but options might include creating a simple small table to 'fool' the system. That table would have primary key and one field (call it SearchTown if you like), then include that table in the query that supplies the form and insert a combo box for that field. When you then create the subform you match the subform field Town to SearchTown. For the combo box (drop down list) source you insert a query to list the towns from where these are stored (using group by to list each once if needed).
RE: subform / combo box
Hi Mark
Thanks for your help. Therefore I have created a Form with the fields I want to via from my query. I have named it 'subformmain'. I have then created a Form named 'Main' and have added a subform using the wizard and have selected 'subformmain'. I added a combobox using the wizard and selected the option to select a value on my form from the 'country' field. Now if I add another combobox to filter the country by 'town' again using the wizard, select a value of my form it does select the town but when I open the combobox I see all the towns in the table/query and when a twon is selected it returns all the towns for that country.
Any ideas?
Thanks
RE: subform / combo box
Hello again Neal,
I'm not sure if you are putting the combos in the subform or main form. There is a 'classic' problem and answer case for twin combos to be found in text books which seem to just launch into vba code regardless. However, I often find there are ways round not having to use code.
If you can tell me if the country and town fields are in the same table, and whether or not the data behind the main part of the form is related (and how) to the subform then we may be able to get at least one of the two fields filtered by one means and the other by a different one.
Regard, Mark
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Calculating The Difference Between DatesIf you wish to calculate the time between two date fields, this can be done in a number of ways: |