February 8, 2005 at 10:15 am
I am trying to delete an entire record in a SQL table and it contains a identity column. I have this code currently and it gives me tis error: You Must Use teh dbSeeChanges option with Open Recordset when accessing a SQL server table that has an IDENTIY column.
Dim DB As Database
Dim SQL As String
SQL = "DELETE * FROM dbo_tblLabor where Counter = " & Right(lbxTimeEntry.SelectedItem.Key, Len(lbxTimeEntry.SelectedItem.Key) - 4)
Set DB = CurrentDb
DB.Execute (SQL)
any help would be great
February 8, 2005 at 10:25 am
"DELETE * FROM" is MS-Access syntax.
In SQL Server, it is simply "DELETE FROM TableName" (or "DELETE TableName") - I suspect the presence of the '*' implies columns and a resultset being returned, which is causing the error.
February 8, 2005 at 10:29 am
I tried that and that didn't make any difference, I am wondering if it has anything to do with the db.Execute (SQL) maybe their is more parameters i need to include
February 8, 2005 at 10:57 am
Have you tried something like:
Dim oConn As ADODB.Connection
Dim oRS As ADODB.Recordset
Dim strConn As String
DIM strsql As String
Set oConn = New ADODB.Connection
strConn = [ado connection string]
Set strsql = [T-SQL statement]
oConn.Open (strConn)
oConn.Execute (strsql)
Set oRS = oConn.Execute(sSQL)
February 9, 2005 at 7:49 am
Give this a try
db.execute sql, dbseechanges
February 9, 2005 at 10:40 am
check
in MSDN
Vasc
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply