Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default sql to database

Hi,
On MS Excell using VBA, I would like to send a sql command to and MS Access
database

"delete * from mytable where id=89"

Thank you all!!!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default sql to database

Try This:

Create two objects in Access.
1. A Query that deletes the records from the table.
2. A Macro that runs the query.

In Excel VBA Editor:
1. add a reference to your version of Access.
2. Inset this code that will start a new instance of Access and run
the macro

Sub RunAccessQuery()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.Visible = True
appAccess.DoCmd.SetWarnings False
appAccess.OpenAccessProject ("C:\Test.mdb")
appAccess.DoCmd.RunMacro ("MacroToDeleteRecordsWith89")
appAccess.DoCmd.SetWarnings True
appAccess.Quit
Set appAccess = Nothing
End Sub

I did not test code, so be sure to test on a test application.

Goshute
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default sql to database

Thank you!!


Reply
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
Update Excel Database via Access Main Database with a script Finnbar New Users to Excel 2 November 3rd 08 07:24 PM
HELP: VBA Code to extract data from an SQL Server database and put it into Access Database Clinton M James[_2_] Excel Programming 1 October 8th 07 12:44 AM
database query not showing foxpro database How I import data mangat New Users to Excel 1 June 24th 07 03:31 PM
How to make reference to database and if true copy from database? V!p3r Excel Discussion (Misc queries) 4 February 5th 07 02:19 PM
Using Excel as a database and need macro or vba to take data entered on one tab and update the database by adding to the next avail row rjr Excel Programming 5 June 11th 06 09:43 PM


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

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"