Delete an Employee

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to Access and putting together a form for other users in the office
to use. When an employee retires/quits this form would allow you to delete
an employee. I chose the Delete Record from the command button, when I
choose an employee from a drop down list, it shows that employee but when I
click on the "Delete Record" command button it reflects the employee at the
top of table and that is the employee that gets deleted. It will not delete
the current employee that is being selected. Any advice would be
appreciated. Thanks.
 
Melinda said:
I am new to Access and putting together a form for other users in the
office
to use. When an employee retires/quits this form would allow you to
delete
an employee. I chose the Delete Record from the command button, when I
choose an employee from a drop down list, it shows that employee but when
I
click on the "Delete Record" command button it reflects the employee at
the
top of table and that is the employee that gets deleted. It will not
delete
the current employee that is being selected. Any advice would be
appreciated. Thanks.

Your problem is probably connected to the action of the combo box, but can I
make a suggestion? How about having a "deleted" flag that you can put
against each record? Or better yet, "retired" and/or "no longer employed"
flags? That way you have a history of comings and goings and if a person
leaves but comes back, you can just take the flag off and not have to enter
their details in again.

Just my 2p worth :-)

Keith.
www.keithwilby.com
 
Your dropdown list can be designed to pull up the appropriate employee
record when you select a value from it. The easiest way would be to
use the wizard. When you create the dropdown, there should be an
option that says "Find a record on my form based on the value I
selected in my combo box." Now when you select the value and delete
the record, you should be deleting the correct one.

Hope that helps!
 
When I created the combo box in the table, you choose the Employee's Name and
it forces the Employee ID number into the next field---would I go back into
the table to select the value?
 
I don't understand your question. You set up the combo box using the
option I told you. The wizard will ask you for a data source and you
should probably chose EmployeeID and EmployeeName. When you choose the
value from the list, all your fields on the form should populate
properly if they are bound to a field in the form's Record Source.
 
Melinda

Are you quite certain you'll not need to refer back to that employee's data?

If your database has "child" records related to the employee's record, won't
those be "orphaned" if you delete the employee record?

Would it be sufficient to no longer see that <deleted> employee on your
drop-down list? This can be easily accomplished!

If you want to do this, add a field to the Employee table and a conrol to
the Employee form. If you only need to know THAT someone's gone, make it a
Yes/No/Checkbox. If you'd like to know WHEN someone left, make it a
Date/Time field/control.

Use the combo box to pull up a to-be-"deleted" employee's record. Check the
checkbox or put the termination date in.

Now, modify the query underlying your combo box (and if you didn't have one,
make one!). Include a selection criterion for excluding the "terminated"
employee records.

Finally, you'll need to add code to refresh that combo box, something like:

Me.YourComboBox.Requery

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top