ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting a record from Access data base using programming from excel (https://www.excelbanter.com/excel-programming/343097-deleting-record-access-data-base-using-programming-excel.html)

dipak

Deleting a record from Access data base using programming from excel
 

Hello,

I have some program written in MS excel macro. And from there I a
trying to delete a record with a condition from a MS Access database.
am not been able to get the code right. Can any one help me with sampl
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 th
Salary table.

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

Regards,
Dipa

--
dipa
-----------------------------------------------------------------------
dipak's Profile: http://www.excelforum.com/member.php...fo&userid=2818
View this thread: http://www.excelforum.com/showthread.php?threadid=47710


Vacation's Over

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




All times are GMT +1. The time now is 01:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com