?
Solved

Access 2007 - Set

Posted on 2011-02-10
4
Medium Priority
?
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 2000 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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