PC Review


Reply
Thread Tools Rate Thread

Delete Query

 
 
=?Utf-8?B?SlQ=?=
Guest
Posts: n/a
 
      16th Mar 2006
I would like to run a delete query with VB but I'm having trouble getting
started. Ideally, I would like to do this from outside of my database. The
user would like to push a button on an Excel spreadsheet that would kick off
the delete query. Thanks for the help......
--
JT
 
Reply With Quote
 
 
 
 
Tim Ferguson
Guest
Posts: n/a
 
      16th Mar 2006
=?Utf-8?B?SlQ=?= <(E-Mail Removed)> wrote in
news:F3897E67-8BC2-4452-B95A-(E-Mail Removed):

> I would like to run a delete query with VB but I'm having trouble
> getting started. Ideally, I would like to do this from outside of my
> database. The user would like to push a button on an Excel
> spreadsheet that would kick off the delete query. Thanks for the
> help......


It's practically the same as in Access, except that Excel won't open the
database for you so you have to do it yourself.

public sub ExcelProc()
dim dbe as new dao.dbengine

dim db as dao.database
set db = dbe.OpenDatabase("c:\blah.mdb",false, false)

dim jetSQL as string
jetSQL = "DELETE FROM MyTable WHERE MyPK = 1028"

db.Execute jetSQL, dbFailOnError

db.Close
set db = nothing
set dbe = nothing

end sub


Hope that helps


Tim F

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Query - Delete matching records from 2 tables - Access 2000 Chris Stammers Microsoft Access Queries 4 22nd Jan 2009 03:45 PM
Delete query unable to delete records from table. Fix how? =?Utf-8?B?TG9uZ1RvbQ==?= Microsoft Access Queries 8 15th Apr 2007 12:29 PM
Delete Query Error "Can't delete from specified tables Maureen227 Microsoft Access Queries 4 26th Jul 2006 05:58 PM
Delete Query Error "Can't delete from specified tables Maureen227 Microsoft Access 6 26th Jul 2006 04:36 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) resant_v@yahoo.com Microsoft Excel Misc 1 8th Mar 2006 11:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 AM.