S
Steven
I have 3 questions:
1) Begin Tran , CommitTran, and Rollback do not work using a basic append
query by using the DoCmd.OpenQuery?
2) What happens if I am using wrkDefault.BeginTrans and begin a
dbs.Execute that takes 15 seconds to process and in that time the electricty
shuts off? If in the example below the elctricity shuts off while doing the
dbs.Execute then the code would never get to the code wrkDefault.CommitTrans
dbForceOSFlush; what would happen when the user goes back to that procedure.
Can I be assured that no data was updated and I am not left with inconsistent
data. Does anything need "flushed"?? Rollbacked?? or something like that?
'***Begin Example***
Dim dbPath, dbName As String
Dim dbs As Database
Dim wrkDefault As Workspace
Set wrkDefault = DBEngine.Workspaces(0)
dbPath = "C:\"
dbName = "db2.mdb"
dbName = dbPath + dbName
wrkDefault.BeginTrans
Set dbs = OpenDatabase(dbName)
dbs.Execute " INSERT INTO Table1 " _
& "SELECT Name " _
& "FROM [Table3];"
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans dbForceOSFlush 'dbForceOsFlush actual value
is 1
Else
wrkDefault.Rollback
End If
dbs.Close
'***End Example***
3) Lets say I am working in database U:\Systems\MainSys.dbs and want to
INSERT from TableOne in MainSys.mdb into TableOneBU in
U:\Shared\tablebackup.mdb. Can that be done? Note: I do not want to have a
link of the table from U:\Shared\tablebackup.mdb into the MainSys.mdb Were
can I get instructions on that? I am thinking it works using the WorkSpaces.
That's a lot of questions. Thank you for your help.
Steven
1) Begin Tran , CommitTran, and Rollback do not work using a basic append
query by using the DoCmd.OpenQuery?
2) What happens if I am using wrkDefault.BeginTrans and begin a
dbs.Execute that takes 15 seconds to process and in that time the electricty
shuts off? If in the example below the elctricity shuts off while doing the
dbs.Execute then the code would never get to the code wrkDefault.CommitTrans
dbForceOSFlush; what would happen when the user goes back to that procedure.
Can I be assured that no data was updated and I am not left with inconsistent
data. Does anything need "flushed"?? Rollbacked?? or something like that?
'***Begin Example***
Dim dbPath, dbName As String
Dim dbs As Database
Dim wrkDefault As Workspace
Set wrkDefault = DBEngine.Workspaces(0)
dbPath = "C:\"
dbName = "db2.mdb"
dbName = dbPath + dbName
wrkDefault.BeginTrans
Set dbs = OpenDatabase(dbName)
dbs.Execute " INSERT INTO Table1 " _
& "SELECT Name " _
& "FROM [Table3];"
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans dbForceOSFlush 'dbForceOsFlush actual value
is 1
Else
wrkDefault.Rollback
End If
dbs.Close
'***End Example***
3) Lets say I am working in database U:\Systems\MainSys.dbs and want to
INSERT from TableOne in MainSys.mdb into TableOneBU in
U:\Shared\tablebackup.mdb. Can that be done? Note: I do not want to have a
link of the table from U:\Shared\tablebackup.mdb into the MainSys.mdb Were
can I get instructions on that? I am thinking it works using the WorkSpaces.
That's a lot of questions. Thank you for your help.
Steven