searching for records using a form

  • Thread starter Thread starter zaps via AccessMonster.com
  • Start date Start date
Z

zaps via AccessMonster.com

Hi there. I'm confused. I want to be able set up a form so that whatever I
select in the combo box, I get the coresponding records. For example, if I
select the "marketing" department in the combo box, I would like to see all
the employees that work in the "marketing" department. I'm getting confused
as to whether the combo box showing the departments should be bound or
unbound?? I don't want to use the form to add records, just to search
through existing records. I am using Access 2000.

Any help is much appreciated,
Zzzzzzaps
 
I have tried using the combo box wizard, but I only am able to select one
record at a time. I would like to show all employees that work in a
particular department.

Thanks again
zaps
 
Hi there. I'm confused. I want to be able set up a form so that whatever I
select in the combo box, I get the coresponding records. For example, if I
select the "marketing" department in the combo box, I would like to see all
the employees that work in the "marketing" department. I'm getting confused
as to whether the combo box showing the departments should be bound or
unbound?? I don't want to use the form to add records, just to search
through existing records. I am using Access 2000.

You can set the Form's Filter property in the AfterUpdate event of the
combo box. E.g.

Private Sub cboDepartment_AfterUpdate()
If IsNull(Me!cboDepartment) Then ' clear the filter
Me.Filter = ""
Me.FilterOn = False
Else
Me.Filter = "[DepartmentID] = " & Me.cboDepartment
Me.FilterOn = True
End If
End Sub

Adjust fieldnames and control names to your situation of course.

John W. Vinson[MVP]
 
Back
Top