By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

combo box filtering -access2007

P: 23
i've got 2 tables tblCompany and tblHrtasks and on the form:

when i choose the company name, the subform gives the details of employee attached to that company; but there is a combo box in the subform for choosing the employee and i want a filter on the combo (on the subform) so that it displays only employees those are attached to the company (based on the selection before from the master form)

following is the code in the afterupdate of the combo in the main form:

Private Sub Combo14_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[id] = " & Str(Nz(Me![Combo14], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
[Forms]![form1]![hr_tasks_frm].Visible = True
End Sub

this displays all the employees belong to the selected company from the combo [combo14] on the main form (Form1)

Now:

on the subform [Forms]![form1]![hr_tasks_frm] i've got a combo [combo18] in which i want to filter only those employees belong to the selected in combo14;

this will help user to choose fast the employees and do the necessary human resources tasks on them

help very much appreciated
thanks
Nov 19 '07 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,366
You're looking for the Cascading Combo/List Boxes Tutorial.
Nov 19 '07 #2

P: 23
thanks but one of my combo in the main form and the other one in subform; in this scenario how can this work; i get confused
Nov 19 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
Depends on where you're at. If you're in the main form then you use Me.SubformControlName.Form.ControlName. If you're in the subform then you use Me.Parent.ControlName.
Nov 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.