Solved

Access 2007 - Set

Posted on 2011-02-10
4
279 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

932 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

15 Experts available now in Live!

Get 1:1 Help Now