Find and Delete specific record

gobyg

Registered User.
Local time
Today, 12:55
Joined
Jul 18, 2013
Messages
20
Hello,

Table Name: Admin
Field Name: userid, admin (Y/N), Password, ConPw, PasswordReset (Y/n), Createdby

Trying to run a vba to find and delete records that was "createdby" the current user. Enviorn("username")

Any help please
 
try

Code:
currentdb.execute("DELETE * FROM ADMIN WHERE CreatedBy='" & Environ("UserName") & "'")
 
Warning deleting records are FINAL!!

Just execute a delete query with a Where-Clause that specify which records are to be deleted.

Code:
CurrentDb.Execute "Delete From Admin Where Createdby = '" & Environ("username") & "'", dbFailOnError

JR
 

Users who are viewing this thread

Back
Top Bottom