469,950 Members | 2,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

combo box filtering -access2007

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
3 1826
Rabbit
12,516 Expert Mod 8TB
You're looking for the Cascading Combo/List Boxes Tutorial.
Nov 19 '07 #2
kaib
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
12,516 Expert Mod 8TB
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.

Similar topics

1 post views Thread by Alex | last post: by
2 posts views Thread by Sean | last post: by
reply views Thread by Scott Loupin | last post: by
5 posts views Thread by jjyconsulting | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.