boblife42
06-25-2008, 06:11 AM
What I am trying to do is match the Employee Number on a form to a employee number in a table to populate a combobox, the combobox will be populated with the different number of hours that the employee could work in a day, once a number of hours is chosen then the text fields for in and out will be populated. Here is the code I have:
Private Sub cbo_HoursPerDay_AfterUpdate()
If Me.cbo_HoursPerDay.RowSource = "SELECT * FROM tbl_EmployeeShiftInformation WHERE strEmployeeNumber = " & Forms![frm_EmployeeData]!EmployeeNumber Then
Me.InAmTime.Value = Me.cbo_HoursPerDay.Column(2)
Me.OutAmTime.Value = Me.cbo_HoursPerDay.Column(3)
Me.InPmTime.Value = Me.cbo_HoursPerDay.Column(4)
Me.OutPmTime.Value = Me.cbo_HoursPerDay.Column(5)
End If
End Sub
What happens is that all the hour choice for all employees populate the combobox and the text fields are not being populated. I would be grateful for any help.
Thank you
Private Sub cbo_HoursPerDay_AfterUpdate()
If Me.cbo_HoursPerDay.RowSource = "SELECT * FROM tbl_EmployeeShiftInformation WHERE strEmployeeNumber = " & Forms![frm_EmployeeData]!EmployeeNumber Then
Me.InAmTime.Value = Me.cbo_HoursPerDay.Column(2)
Me.OutAmTime.Value = Me.cbo_HoursPerDay.Column(3)
Me.InPmTime.Value = Me.cbo_HoursPerDay.Column(4)
Me.OutPmTime.Value = Me.cbo_HoursPerDay.Column(5)
End If
End Sub
What happens is that all the hour choice for all employees populate the combobox and the text fields are not being populated. I would be grateful for any help.
Thank you