Transaction problem new post 2

R

Rotsey

I removed the transaction and the code ran fine.

So then I tried this. Added this global variable

Set gobjConn = gobjWSodbc.OpenConnection(mConnectName, dbDriverNoPrompt,
False, _
"ODBC;DSN=" & rs!DSN & ";SERVER=" & rs!Server &
";WSID=LESTER34;DATABASE=" & rs!Database &
";TranslationName=Yes;QueryLogFile=Yes")

Then changed this line to

Set rs2 = gobjDBodbc.OpenRecordset(sql, dbOpenSnapshot)

to
Set rs2 = gobjConn .OpenRecordset(sql, dbOpenSnapshot)

And all works fine.


rotsey





I could be wrong about the source of the problem. As a test to attempt to
narrow it down a bit, could you try temporarily running the code without
using a transaction, by commenting out the lines indicated below. The result
should at least confirm whether the problem is related to the use of
transactions or not.

'temporarily comment out this line
'objws.Begintrans

For cntr = 1 to NmberOfInvoiceToCreate

invno = CreateInvoiceNumber(CustNoDetails(cntr))

SQL = "SELECT * FROM Invoices WHERE invNumber = " & invno
Set rs2 = gobjDBodbc.OpenRecordset(sql, dbOpenSnapshot)


if rs2.bof then
CreateInvoice(invno)
Endif

Next

'temporarily comment out this line
'objws.CommiTrans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top