472,122 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,122 software developers and data experts.

combo box filtering -access2007

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)


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
Nov 19 '07 #1
3 1943
12,516 Expert Mod 8TB
You're looking for the Cascading Combo/List Boxes Tutorial.
Nov 19 '07 #2
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
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.