Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to delete a record

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
In my employee form.. I have a field "payroll" The user enters in the employee payroll hits a button.. and its pulls the employees Name, Supervisor, Department, Division...

That part works fine..

The reason for me pulling this information up is because.. I want delete that record.. Say an employee gets fired or retires or something.. then the user enters in the paroll number .. employee info comes up.. now delete the record...

I added a delete button in the wizard.. just to see if it would work.. knowing that it wouldnt.. i tried it and yes.. and didnt work..

my question is.. how can i make that button that I added on the form to delete that particualr record that i pulled up ??

thanks
 
In the command button Click event:

DoCmd.RunSql "Delete * FROM [Employees] WHERE [Payroll Number] = '" & Me![payroll] & "' ;"

Hope this helped!

Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Being a paranoid DBA, I wouldn't delete the record but add a status field to the record stating Fired, Retired, etc. But the DELETE SQL statement above should work.

Just a suggestion.



RUN FunnySignatureMessage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top