Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2007 - Set

Posted on 2011-02-10
4
Medium Priority
?
320 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

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.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

609 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