I have a combo box with 4 employees in it
ID EmployeeNumber FirstName LastName
1 010101 Joshua Dalley
2 020202 Jessica Daze
3 030303 Jason Bruyere
4 040404 Jeremy Bob
when I display the combo box, everything seems normal. I have a onChange() code which updates the firstName / lastName text box
Private Sub cboEmployeeNo_Change()
Me.txtFirstName.Value = Me.cboEmployeeNo.Column(2)
Me.txtLastName.Value = Me.cboEmployeeNo.Column(3)
End Sub
My problem is, when I close my form frm_login, while I have selected any ID, it seems to always overwrite the first ID=1 with the last employee selected in the combo box. I do not know how to fix this. It only changes the FirstName and LastName, while EmployeeNumber stays the same.
Example
ID EmployeeNumber FirstName LastName
1 010101 Jason Bruyeye
2 020202 Jessica Daze
3 030303 Jason Bruyere
4 040404 Jeremy Bob
This would be my table if I close it while viewing the ID=3
Default View: Single Form
Allow Form View: Yes
Allow Datasheet View: No
Allow PivotTable View: No
Allow PivotChart View: No
Scroll Bars: Neither
Record Selectors: No
Navigation Buttons: No
Border Style: Thin
Record Source: tbl_employee
Allow Filters: No
Allow Edits: Yes
Allow Deletions: No
Allow Additions: No
Data Entry: No
OnChange()
method, and see if your problem occurs. - Mark C.FirstName
andLastName
. While the form may be on the first record, you selectJason
is change the values for the first record's data. - Mark C.