Workspaces

S

Steven

I have created a workspace and I am doing 3 dbs.Execute
functions.

wrkDefault.BeginTrans

Set dbs = OpenDatabase(dbName)

dbs.Execute "INSERT INTO ....etc"
dbs.Execute "UPDATE .... INNER JOIN ..... etc"
dbs.Execute "DELETE table.* from table"

If MsgBox("Save and commit?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans dbForceOSFlush
Else
wrkDefault.Rollback
End If

If I choose NO and do the wrkDefault.Rollback everything
appears to work fine except when I go back and open a
recordset on the table where I was deleting the records
the rst.RecordCount = 0 ; but the table still has the
records as I expected because I did not commit the
transaction. Why does the rst.RecordCount say 0 when the
table actually has records?

Thank you for your help.

Steven

..
 
D

Dutch

Do not use rst.RecordCount. Use rst.bof and rst.eof; if
both of these are true then there are no records. If one
or both are false then the table has records. Put this in
your program where you are opening the record set after
you have not committed the records.

MsgBox rst.bof
MsgBox rst.eof
MsgBOx rst.RecordCount

This will prove interesting to you.
 

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

Top