PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Delete Query
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Delete Query
![]() |
Delete Query |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
=?Utf-8?B?SlQ=?= <JT@discussions.microsoft.com> wrote in
news:F3897E67-8BC2-4452-B95A-743AA811D655@microsoft.com: > 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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

