LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Deleting records from access using ADO in through Excel

Hi,

I would like to be able to delete multiple records in Access from a
procedure in Excel.

At the moment i have a macro set up in Excel that can look at my
database and tell me if there are any records in it that have "Month =
7". I'd like to have a pop-up box in Excel that then asks if the user
would like to delete all records from the database that match the
criteri "Month = 7".

My code looks like this:

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=G:\test.mdb"
rs.Open "TestTable", cn, adOpenKeyset, adLockOptimistic,
adCmdTable
rs.Find ("Month = '7'")
If rs.AbsolutePosition 0 Then
Test = MsgBox "TestMessage",vbYesNo, "Warning")
End If
If Test = vbYes Then
rs.Filter = "Month = '7'"
rs.Delete
rs.Close
End If

---------
At the moment this code does nearly all i want it to do, except when i
get to the rs.Delete line. It only deletes one record, and not all
the records that have been found using the rs.Filter line.

Can anyone tell me how i can get the macro to delete every record
brought back from the rs.Filter line.

Many thanks in advance

Chris
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting NEARLY multiple records in excel rwbana Excel Discussion (Misc queries) 4 May 8th 08 05:39 PM
Import Access records into Excel dksaluki Excel Discussion (Misc queries) 1 December 20th 07 07:08 AM
How do I display duplicate records in Excel without deleting? jkc1 Excel Worksheet Functions 1 August 23rd 06 07:18 PM
Linking Access Records to Excel MayraEllen Excel Worksheet Functions 0 August 21st 06 07:37 PM
Access records updating from Excel. Dirk Batenburg Excel Programming 2 October 8th 03 03:06 PM


All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"