Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default SQL Delete Record using Excel VBA

I have no problem reading, writing and counting from a table using this VBA /
SQL connection, but when I try to delete a record it does nothing. Any
suggestions would be welcome. Sometimes I get nothing, but lately I've been
getting a 1004 'General ODBC error.'



Thanks, Steve


Here's my code:
Dim SH As Object
Set SH = Sheet1
With SH.Range("Query_from_Loewenpr").QueryTable
.Connection = "ODBC;DSN=loewenpr;"
.CommandText = Array( _
"DELETE FROM DBPR.DHXSLRTLIB.DHLOC " & _
"WHERE DHLOC.BUSINESS_UNIT = '" & "DHTEST" & _
"')" _
)
.BackgroundQuery = False
.Refresh BackgroundQuery:=False
End With
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
How to delete duplicate record Lillian Lian Excel Programming 2 December 8th 07 12:03 AM
find last record in macro and delete all after Sherife Excel Programming 3 September 18th 06 03:58 AM
delete record based on a value Anauna Excel Programming 3 June 27th 05 08:47 PM
How To Delete First Record In A Text File MarkInSalemOR Excel Programming 0 November 8th 04 09:55 PM
delete record using Macro in excel spreed sheet Lillian[_3_] Excel Programming 47 December 3rd 03 04:06 PM


All times are GMT +1. The time now is 02:21 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"