access2007 creating a transaction - timeout error -
11-22-2011
, 06:33 PM
using access2007 and sql server 2005 linked tables
trying to create a transaction with many UPDATEs, INSERTs and SELECTs
this is required to get new autonumber IDs as they are created
I tried using DAO and ADODB to insert the record below,
this makes it easy to use lastModified to get the autonumber field,
bookingId
both objects failed
so I changed to an INSERT statement, like this
Set wks = Application.DBEngine(0)
Set db = CurrentDb
wks.BeginTrans
strsql = "SELECT max(bookingId) as m_bookingId FROM tblX WHERE
quoteId = " & quoteId
Set rs = db.OpenRecordset(strSql, dbOpenDynaset, dbFailOnError +
dbReadOnly) ' this works
strSql = "INSERT INTO tblX (booked) " & _
" values (-1)"
db.Execute strSql, dbFailOnError
strsql = "SELECT max(bookingId) as m_bookingId FROM tblX WHERE
quoteId = " & quoteId
Set rs = db.OpenRecordset(strSql, dbOpenDynaset, dbFailOnError +
dbReadOnly) ' this errors out with a timeout
if I look at the sql server activity monitor for this last statement,
is shows that it is blocked
by the 'INSERT...' process, but I just want to read the value of
'bookingId', thus dbReadOnly
is there a combination of parms 2 and 3 in db.openRecordset() that
will work ?
any other ideas ? |