I have an Access database that has one table containing employee information. I have created Forms for easy user-interface. I am having problems with one of my forms.
When looking at my main menu (a form) you see employee names. You can select a name and click an "edit/delete" button that opens a pop-up form showing all the information for that employee.
I have a button on that pop-up form to delete the employee you are viewing. The problem is my code is deleting all records in the table, not just the record being viewed.
Here is my code:
Private Sub deleteRecords_Click()
Dim db as Database
Set db = CurrentDb
db.Execute "Delete * From employees;"
End Sub
Also, could someone please explain what Dim db and Set db do? I just copied them from online? Thanks!
When looking at my main menu (a form) you see employee names. You can select a name and click an "edit/delete" button that opens a pop-up form showing all the information for that employee.
I have a button on that pop-up form to delete the employee you are viewing. The problem is my code is deleting all records in the table, not just the record being viewed.
Here is my code:
Private Sub deleteRecords_Click()
Dim db as Database
Set db = CurrentDb
db.Execute "Delete * From employees;"
End Sub
Also, could someone please explain what Dim db and Set db do? I just copied them from online? Thanks!