Solved

Access 2007 - Set

Posted on 2011-02-10
4
270 Views
Last Modified: 2012-06-27
Sorry to keep popping out so many Access questions.  Here comes another one...

I have a form that I generated with the form wizard and it has a tabular format.  So it has a head, a detail and a foot.  In the detail portion of the form I have a list of text box and combo box controls that are bound to each record in the table the form is bound to.  So a new row of these controls is created for each record in the table.

This form sits as a subform inside of another form, which has a combo box control on it.  I've already got the form so that it filters the records shown in the sub form when you choose a value from the combo box, But what I need to do now is to be able to change the rowsource on the combo boxes in the sub form based on the selection made in the combo box on the parent form.

I'm pretty sure it wouldn't be that hard to do from VBA code, but I'm not sure how to find the control in VBA to manipulate it.

Any help on this would be great.

Thanks
0
Comment
Question by:JosephEricDavis
  • 2
  • 2
4 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 500 total points
ID: 34864276
use the afterupdate event of the first combo

private sub combo1_afterupdate()

me.subformName.form.combo0.rowsource="select f1,f2 from table where f2="  & me.combo1

end sub
0
 
LVL 7

Author Comment

by:JosephEricDavis
ID: 34864431
Ok... that's what I was going for to begin with, but I made the poor mistake of trusting intellisense and because I didn't have the control name in the list of available terms I figured it would cause an error if I forced it.  Which it didn't.  So it works.

But I have one more questions related to this if I may ask really quick...

In the same form as part of the same record there are actually two combo boxes.  The first one is dependent on the main combo box on the form to determine it's available values.  The second combox in the record is going to depend on the first combo box to determine it's available values.

So there are two things I need to do here.  The first to have the second combo box disabled until the user selects a value from the first combo box.  The second is to be able to populate the second combo box based on the value selected in the first combo box.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34864458
just do the same thing, now using the afterupdate of the combo1 in the subform

private sub combo1_afterupdate()
me.combo2.enabled=true
me.combo2.rowsource="select f1,f2 from table where f2="  & me.combo1

end sub
0
 
LVL 7

Author Closing Comment

by:JosephEricDavis
ID: 34864615
Sweet, Thanks
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now