Making a form in Access

By lucy_r_harris ·
Hello! I'm trying to create a form that only gives certain options if a particular box is selected i.e if there's a choice between business types, if one is selected a series of other options relevant only to that type of business is visible, but not included if the other type is selected and vice versa.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

This is called synchronized combo boxes.

by bsmith523 In reply to Making a form in Access

You need to know some basic VBA to accomplish this task. Basically you create the first combo box as usual. Then you set the row source for the second combo box to the data you want filtered to the contents of the first combo box. You will need to use VBA to requery the second box every time you change the value in the first box. Let me know if you are familiar enough with VBA to try this and I can provide more details.

Collapse -

I'm not too experienced

by lucy_r_harris In reply to This is called synchroniz ...

I'm mainly learning as I go, so don't really know a huge amount of VBA - a few hints would be greatly appreciated and I'll have a play around though!

Collapse -

Here you go.

by bsmith523 In reply to I'm not too experienced

First create your first combo box (#1) linked to the table with the business types. In the properties for the combo box there is a parameter called "name" under the "other" tab. Make sure to remember this name or give it a name you will remember. Depending on how you created it Access may have given it a default name of the field from the table it is linked to. I hate this and usually rename it to something else.

Now create your second combo box (#2). Remember this name too. For #2 the row source will be the table that has the info you want. This table should also have the business type. Instead of just linking it to this table you will want to click on the ... button next to that column and get to the query builder. Pick the field with the info you want to show and the field with the business category. Then under criteria for the business category put in without the quotes "[forms].[NameofForm].[Name Of #1]".

Now go back to the properties of #1. Under the event tab, find the parameter "on change". Click on the ... to the right of this. You will get a windows that asks what you want to do. Pick code builder. You will be taken to the VBA screen. Where the cursor ends up type in the following.


Go save everything and see if it works.

Collapse -


by lucy_r_harris In reply to Here you go.

Thanks very much, will try it ASAP and let you know :)

Related Discussions

Related Forums