PDA

Click to See Complete Forum and Search --> : Transaction??????!!!!!!!!


Stevie
May 2nd, 2000, 11:36 PM
I'm using VB6 with ADO to connect to Access.
I have a form which is used for batch input, and another form which is used to view all the batches.
On the input form you can add, alter and delete items from a batch. In each of these cases a Transaction is used, and all works fine. From the batch view form (which displays all batches in a listview) you can double click on any batch item, and the batch input form is displayed with the details displayed for the selected batch item. The problem is when I try to delete or alter this item I get the following error message, and I have absolutely no idea why. :confused:

-2147467259 Attribute can not be set now.

It occurs on the BeginTrans statement.

Please HELP!!

[Edited by Stevie on 05-03-2000 at 05:40 PM]

lychew
May 3rd, 2000, 03:02 PM
Are you trying to set the recordset before the begintran??

Stevie
May 3rd, 2000, 03:52 PM
Nope.

It all works fine when using the batch input form. It only keels over when using the functionality in the form from another form.

lychew
May 3rd, 2000, 04:04 PM
If i remember correctly, you can not have an open recordset before the begintrans. All the recordsets must be close before you open a transaction. Then open another recordset in that transaction. Try this.

Stevie
May 3rd, 2000, 05:06 PM
As far as I can see I have no recordsets open. I have so many that it is easy to miss in the code.

Is there a way of closing all open recordsets?

Stevie
May 3rd, 2000, 05:15 PM
I've just been looking through the help about transactions, and in it they give an example where a recordset is open just before the BeginTrans, so that appears not to be the problem.

Any other ideas?

Stevie
May 3rd, 2000, 07:57 PM
Talk about conflicting info. In the help it gives an example with an open recordset before a BeginTrans statement, but whilst searching through MSDN I found something that said you should close the connection and re-open it.

To cut a long story short, I closed and re-opened the connection before the BeginTrans statement (when using from another form) and it all works well. :D

Thanks for the help. :)

[Edited by Stevie on 05-05-2000 at 12:05 AM]