View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vacation's Over Vacation's Over is offline
external usenet poster
 
Posts: 279
Default Deleting a record from Access data base using programming from exc

Generically - use delete instead of select

whatever records would have been returned by select will be deleted

With the DB open, since you are deleting the record you do not need anything
between DELETE and FROM:

CurrentDb.Execute "DELETE FROM MyTable WHERE EMPNO = ______ ";

"dipak" wrote:


Hello,

I have some program written in MS excel macro. And from there I am
trying to delete a record with a condition from a MS Access database. I
am not been able to get the code right. Can any one help me with sample
code please.
My scenario would be as follows:

I have a Employee salary table having feilds as EMPNO, Month and SAL.

Now with my current code all the records are getting deleted from the
Salary table.

I would like to delete the record of a particular employee from the
salary table. But I am not been able to provide the option EMPNo in my
delete statement.

Regards,
Dipak


--
dipak
------------------------------------------------------------------------
dipak's Profile: http://www.excelforum.com/member.php...o&userid=28181
View this thread: http://www.excelforum.com/showthread...hreadid=477102