Cascading Combo Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok. So I have read the previous posts related to this subject and I am still
confused :( I am a complete novice to Access; having only read an access for
dummies book, and looking at Access forums and sites to figure out what to do.

I have a database that is to be used to track revenues generated at various
sites, in various areas. On my revenue form, I have inserted some site
information fileds on one tab of the revenue form.

The fields are: (Taken from the SITES form)

Site ID (autonumber)
Site Number (text)
Site Name (text)

The site number and site name fields are determined based on the heirarchy
chosen by the company I work with.

I have set these up as combo boxes. What I would like to do is: if a
particular site number is chosen, that the corresponding site name and site
ID are automatically filled into the other combo box fields.

I know nothing about VBA so a simple as simple can get explanation would be
great.

Hope I haven't too confusing...yeah right :)

Thanks in advance.
Anderson
 
You need to do three things to make cascading combo's work:
1. The second combo's RowSource must be a query that references the first
combo as its criteria. So in the criteria line of the QBE add:
Forms!YOURFORMNAME!THEFIRSTCOMBONAME
2. In the AfterUpdate event of the first combo, press the button that lets
you create code. In the generated sub add one line:
Me.SECONDCOMBONAME.Requery
3. In the Form's Current event, press the button that lets you create code.
In the generated sub add one line:
Me.SECONDCOMBONAME.Requery
 
Back
Top