S
steve
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
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