Simon said:
Hello all,
How can I program the following steps into a Combo box that's "Bound
to Employees_ID".
1. Save current value of Employees_ID
2. Move to the next record selected from Combo box
3. Restore the value of Employees_ID from step 1.
Are you sure you want to do exactly what you describe? Don't you just
want to move to the chosen record, without changing the employee ID for
the original record?
I agree with Rick B that you shouldn't do this, as even programming
around it leaves the *possibility* of accidentally modifying an employee
ID when you really only wanted to find a different employee. If you
insist on doing it this way, I can give you code to do it, but I
wouldn't feel 100% confident that it would always work without
possibility of error (if something causes the code to break, for
example).
May I suggest an alternative approach? Don't bind the combo box to the
field at all. Leave it unbound, but in the form's Current event, set it
to the value of the Employees_ID field of the current record. Note: to
do this, you have to give the combo box a name other than
"Employees_ID" -- maybe "cboEmployee". If the form allows additions,
you'll also have to use code in, maybe, the form's BeforeInsert event,
to get the value of the new autonumber -- if Employees_ID is one -- and
assign it to the combo box.
If the combo box is unbound, you can freely use it for navigation.