PDA

View Full Version : Error 3157 Update Access 2000-SQLAerver2000



idgye
07-12-2007, 01:51 AM
Hi,

First of all, sorry for my english I'll try to express myself as well as I can.

I have and application made with Access 2000 with SQLServer 2000 (ODBC).

I have a form with 2 Listbox (ListBox1, Listbox2) and a button.

The origin of both are a table (Table1)
On the Listbox1 are 316 rows, then I press the button and all these rows are updated (3 fields of each row- field text,field data and field number), and the listboxes are requery

The error are on de update, but if I press F5 it follow without problems until the next error.

The code more or less is this:
'-------------------------------------------------------------------
B=0
For a to listbox1.listcount-1
follow:
set recordset=Currentdb.Openrecordset("SELECT * FROM Table1 WHERE fildtext='" & me.listbox1.Column(0,B)",dbOpenDynaset,dbSeeChanges)
if recordset.EOF=False then
recordset.Edit
recordset("Factura")=Me.NumberFactura (<-- is a textbox)
recordset("Situacio")=2
recordset("DataFactura")=Me.DateFactura (<-- is a textbox)
on error go to here
recordset.Update Here the error, but it doesn,t happen always
end if
recordset.Close
ListBox1.Rowsource= updating the listbox
ListBox2.Rowsource= updating the listbox
next a
Exit Sub
here:
On Error GoTo 0
MsgBox ("Click the buton again")
err = 0
Exit Sub
'-------------------------------------------------------------------
I've tried to pass the rows only from 50 to 50, but the error appears before to end the 50...
I've captured the error in orther that the client can follow clicking on the button, but it takes a long time to capture the error (capture the error, go to here: and to show the messagebox), I have reviewed the data of the table1 but there are no wrong data

I can't solve this error ....(more than 3 days) Anybody can help me?

Thanks

stanl
07-12-2007, 06:24 AM
I'm assuming you are running a pass-through query to SQL Server; maybe try


set recordset=Currentdb.Openrecordset("SELECT * FROM Table1 with (nolock) WHERE fildtext='" & me.listbox1.Column(0,B)",dbOpenDynaset,dbSeeChanges)



Stan

idgye
07-12-2007, 08:53 AM
Thanks for your reply stanl,

I'd tryed with "with(nolock)" but it doesn't work. It appears and error 3257 (it says more or less :syntax error in the declaration WITH OWNER ACCESS OPTION).

To tell you the truth, I don`t understand what you want to say with "pass-through query" . Can you explain it, please?