Content of subform to display according to main form

  • Thread starter Thread starter Johanna Gronlund
  • Start date Start date
J

Johanna Gronlund

Hello,

I have a basic question about forms (I hope).

I have companies, each providing several different services. I need a form
where data entry clerk can first choose the company from a drop down list and
then all the services that they provide are displayed below (I think I need
to create a subform?). Can anyone give me guidance on how this might be
achieved? Ideally without using code as I am not experienced in this. I have
tried wizards and books but have been unable to do this.

Thanks,

Johanna
 
You need an unbound combo box to act as a filter. Build your form with all
the data then probably the best solution is to build a tables with just the
company name. Make the table of company names the basis of the combo box.
Have the company names in the form also, but hidden. Go into the properties
of the combo and in events use the after update event (the box at the end of
the line.) Start code builder and type:
Me.filter = "[company name] = """ & me.thenameofyourcombobox & """"
Me.filteron = True
Another option would be to build a form with company name and subform with
company data.
 
1. Build a table with two fields. One column is the company name and the
other are the services that company provides.

2. Add all the appropriate records to your table.
Ex. Record 1 = Microsoft (company name), Computer Training (service)
Record 2 = Microsoft, Computer Purchases
Record 3 = Yahoo, Online Shopping
Record 3 = Potterybarn, Kids Clothing

3. Create a combo box on your form with the source being the above table so
the user can pick the company.

4. Create a second combo box that links to a new query that uses your
created table as the source. Include both fields. In the criteria line
under the field for company, put in [Forms]![name of your form]![combo box
field name corresponding to the one where you have your user select the
company name]

Now your drop down on your form will only be limited to the services the
company (who your user selected) provides.
 
Thanks for your reply. I managed to do the combo box with all the companies.
My only problem is that the services section only displays one service per
company and I have to use the arrow on the bottom of the screen to flick from
one service to another. How can I show all the services for one company once?
Or is this even possible?



Golfinray said:
You need an unbound combo box to act as a filter. Build your form with all
the data then probably the best solution is to build a tables with just the
company name. Make the table of company names the basis of the combo box.
Have the company names in the form also, but hidden. Go into the properties
of the combo and in events use the after update event (the box at the end of
the line.) Start code builder and type:
Me.filter = "[company name] = """ & me.thenameofyourcombobox & """"
Me.filteron = True
Another option would be to build a form with company name and subform with
company data.

Johanna Gronlund said:
Hello,

I have a basic question about forms (I hope).

I have companies, each providing several different services. I need a form
where data entry clerk can first choose the company from a drop down list and
then all the services that they provide are displayed below (I think I need
to create a subform?). Can anyone give me guidance on how this might be
achieved? Ideally without using code as I am not experienced in this. I have
tried wizards and books but have been unable to do this.

Thanks,

Johanna
 
Back
Top