![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
the following code segment fails on the update line when intN = 7, with the error below Dim rs4 As ADODB.Recordset for intn = 1 to 10 set rs4 = nothing Set rs4 = New ADODB.Recordset rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic rs4.Properties("Preserve On Commit") = True rs4.Properties("Preserve On Abort") = True rs4.AddNew rs4!handoverId = lngHandoverId rs4!lineNbr = intN rs4.Update next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. if I change to this rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server this makes me think that the error is misleading but I don't know any ideas ? |
#3
| |||
| |||
|
|
Not the problem you are encountering, but since 1 is not = 2, why would you expect to get a record returned ever with a "WHERE 1=2" clause? "Roger" <lesperancer (AT) natpro (DOT) com> wrote in message news:2475eb34-0481-44e4-a4fb-58c5ea08ec92 (AT) 33g2000yqu (DOT) googlegroups.com... the following code segment fails on the update line when intN = 7, with the error below Dim rs4 As ADODB.Recordset for intn = 1 to 10 set rs4 = nothing Set rs4 = New ADODB.Recordset rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic rs4.Properties("Preserve On Commit") = True rs4.Properties("Preserve On Abort") = True rs4.AddNew rs4!handoverId = lngHandoverId rs4!lineNbr = intN rs4.Update next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. if I change to this rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server this makes me think that the error is misleading but I don't know any ideas ? |
#4
| ||||
| ||||
|
|
the following code segment fails on the update line when intN = 7, with the error below Dim rs4 As ADODB.Recordset for intn = 1 to 10 set rs4 = nothing Set rs4 = New ADODB.Recordset rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic rs4.Properties("Preserve On Commit") = True rs4.Properties("Preserve On Abort") = True |
|
rs4.AddNew rs4!handoverId = lngHandoverId rs4!lineNbr = intN rs4.Update next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. Strange. OpenRecordset is a DAO method, not ADO. Is cnn a connection to the |
|
if I change to this rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server Linked table?? So cnn doesn't connect directly to the sql server database? |
|
this makes me think that the error is misleading but I don't know any ideas ? |
#5
| |||
| |||
|
|
I would expect he wants to open an empty recordset with the intention of doing nothing but add new records. Of course, executing a sql INSERT statement directly would be a better plan. Access Developer wrote: Not the problem you are encountering, but since 1 is not = 2, why would you expect to get a record returned ever with a "WHERE 1=2" clause? "Roger" <lesperancer (AT) natpro (DOT) com> wrote in message news:2475eb34-0481-44e4-a4fb-58c5ea08ec92 (AT) 33g2000yqu (DOT) googlegroups.com... the following code segment fails on the update line when intN = 7, with the error below Dim rs4 As ADODB.Recordset for intn = 1 to 10 set rs4 = nothing Set rs4 = New ADODB.Recordset rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic rs4.Properties("Preserve On Commit") = True rs4.Properties("Preserve On Abort") = True rs4.AddNew rs4!handoverId = lngHandoverId rs4!lineNbr = intN rs4.Update next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. if I change to this rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server this makes me think that the error is misleading but I don't know any ideas ? |
#6
| |||
| |||
|
|
I would expect he wants to open an empty recordset with the intention of doing nothing but add new records. Of course, executing a sql INSERT statement directly would be a better plan. Access Developer wrote: Not the problem you are encountering, but since 1 is not = 2, why would you expect to get a record returned ever with a "WHERE 1=2" clause? "Roger" <lesperan... (AT) natpro (DOT) com> wrote in message news:2475eb34-0481-44e4-a4fb-58c5ea08ec92 (AT) 33g2000yqu (DOT) googlegroups.com... the following code segment fails on the update line when intN = 7, with the error below * * * Dim rs4 As ADODB.Recordset * *for intn = 1 to 10 * * * set rs4 = nothing * * * Set rs4 = New ADODB.Recordset * * * rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic * * * rs4.Properties("Preserve On Commit") = True * * * rs4.Properties("Preserve On Abort") = True * * * rs4.AddNew * * * rs4!handoverId = lngHandoverId * * * rs4!lineNbr = intN * * * rs4.Update * *next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 * - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. if I change to this * * * rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server this makes me think that the error is misleading but I don't know any ideas ?- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
Oh, well, I use DAO instead of ADO, and I'd just open a DAO Recordset and use the .AddNew method. My little experiece with ADP and ADO indicated it was usable, but more work than DAO, and no faster than ODBC-linked tables across the same network. I'm told there are things you can do with ADO that are either not possible or not simple with DAO, but I've not suffered for lack of thT functionlity and I've used Access daily since Jan. 1993. -- *Larry Linson, Microsoft Office Access MVP *Co-author: "Microsoft Access Small Business Solutions", published by Wiley *Access newsgroup support is alive and well in USENET comp.databases.ms-access "Bob Barrows" <reb01... (AT) NOSPAMyahoo (DOT) com> wrote in message news:j34iqr$lbh$1 (AT) dont-email (DOT) me... I would expect he wants to open an empty recordset with the intention of doing nothing but add new records. Of course, executing a sql INSERT statement directly would be a better plan. Access Developer wrote: Not the problem you are encountering, but since 1 is not = 2, why would you expect to get a record returned ever with a "WHERE 1=2" clause? "Roger" <lesperan... (AT) natpro (DOT) com> wrote in message news:2475eb34-0481-44e4-a4fb-58c5ea08ec92 (AT) 33g2000yqu (DOT) googlegroups.com.... the following code segment fails on the update line when intN = 7, with the error below * * * Dim rs4 As ADODB.Recordset * *for intn = 1 to 10 * * * set rs4 = nothing * * * Set rs4 = New ADODB.Recordset * * * rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic * * * rs4.Properties("Preserve On Commit") = True * * * rs4.Properties("Preserve On Abort") = True * * * rs4.AddNew * * * rs4!handoverId = lngHandoverId * * * rs4!lineNbr = intN * * * rs4.Update * *next intn ODBC--call failed. ,Microsoft Office Access Database Engine ,-2147467259 * - You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. if I change to this * * * rs4.Open "SELECT * FROM tblSlsDetail WHERE 1 = 2", cnn, adOpenDynamic, adLockOptimistic, dbSeeChanges I get the same error now I'm assuming the IDENTITY column means that the link table would show an 'autonumber' field, but it doesn't nor is it created that way in sql server this makes me think that the error is misleading but I don't know any ideas ?- Hide quoted text - - Show quoted text - |
#8
| |||
| |||
|
|
as to an insert statement, it's a idea, but the example I've provided highly simplifies the fields that are updated - actually there are many fields and the contents is sometimes based on conditions - but I'll look into an INSERT |
#9
| |||
| |||
|
|
sSQL="SELECT handoverId,lineNbr " & _ "FROM tblSlsDetail WHERE 1 = 2" |
#10
| |||
| |||
|
|
Bob Barrows wrote: sSQL="SELECT handoverId,lineNbr *" & _ "FROM tblSlsDetail WHERE 1 = 2" Of course, you should substitute the actual name of the table in sql server rather than using the name of the linked table (if different). |
![]() |
| Thread Tools | |
| Display Modes | |
| |