PC Review


Reply
Thread Tools Rate Thread

transaction processing in MDB?

 
 
=?Utf-8?B?QWxsZW5fTg==?=
Guest
Posts: n/a
 
      20th Feb 2007
I want to process transactions in a batch, so that I can move records from
one pair of tables to another, in safety. I thought I could enclose the
relevant code in a BeginTrans ... CommitTrans loop, but now I think that is
only for ADPs.

How should I be doing this?

Regards,
Allen

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmVXeWNoZWQ=?=
Guest
Posts: n/a
 
      20th Feb 2007
You can use the batch methods. Begin/CommitTrans etc. are members of the
Workspace class in DAO - see Help for guidance.

Cheers.

BW

"Allen_N" wrote:

> I want to process transactions in a batch, so that I can move records from
> one pair of tables to another, in safety. I thought I could enclose the
> relevant code in a BeginTrans ... CommitTrans loop, but now I think that is
> only for ADPs.
>
> How should I be doing this?
>
> Regards,
> Allen
>

 
Reply With Quote
 
Stefan Hoffmann
Guest
Posts: n/a
 
      20th Feb 2007
hi Allen,

Allen_N wrote:
> I want to process transactions in a batch, so that I can move records from
> one pair of tables to another, in safety. I thought I could enclose the
> relevant code in a BeginTrans ... CommitTrans loop, but now I think that is
> only for ADPs.

No, it also applies for .mdbs. Use DBEngine.Workspaces(0).

(From a german microsoft kb article)

---
Sub ChangeTitle()

Dim strName As String, strMessage As String, strPrompt As String
Dim wspDefault As Workspace, dbsNorthwind As Database
Dim rstEmployees As Recordset
strPrompt = "Position in 'Verkaufsrepräsentant' ändern?"
Set wspDefault = DBEngine.Workspaces(0) ' Standard-Arbeitsbereich
' bestimmen.
' Aktuelle Datenbank bestimmen.
Set dbsNorthwind =
wspDefault.OpenDatabase("c:\access\beispiel\NORDWIND.MDB")
' Tabelle öffnen.
Set rstEmployees = dbsNorthwind.OpenRecordset("Personal", dbOpenTable)

wspDefault.BeginTrans ' Transaktion einleiten.

rstEmployees.MoveFirst
Do Until rstEmployees.EOF
If rstEmployees![Position] = "Vertriebsmitarbeiter" Then
strName = rstEmployees![Nachname] & _
", " & rstEmployees![Vorname]
strMessage = "Angestellter: " & strName & Chr(10) & Chr(10)
If MsgBox(strMessage & strPrompt, vbQuestion + vbYesNo, _
"Berufsbezeichnung ändern") = vbYes Then
rstEmployees.Edit ' Änderungen zulassen.
rstEmployees![Position] = "Verkaufsrepräsentant"
rstEmployees.Update ' Änderungen speichern.
End If
End If
rstEmployees.MoveNext ' Zum nächsten Datensatz wechseln.
Loop
If MsgBox("Alle Änderungen speichern?", vbQuestion + vbYesNo, _
"Änderungen speichern") = vbYes Then
wspDefault.CommitTrans ' Änderungen akzeptieren.
Else
wspDefault.Rollback ' Änderungen rückgängig machen.
End If

rstEmployees.Close ' Tabelle schließen.

dbsNorthwind.Close
End Sub


mfG
--> stefan <--
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transaction processing Dwight Microsoft ADO .NET 4 24th Dec 2006 01:13 PM
Access and transaction processing... Brad Pears Microsoft Access Form Coding 13 8th Jun 2006 05:37 PM
RDA and Transaction Processing =?Utf-8?B?TW9iaWxlIFNvbHV0aW9ucw==?= Microsoft Dot NET Compact Framework 1 16th Aug 2005 02:54 AM
A simple example of the use of transaction processing =?Utf-8?B?ZW1lcmI=?= Microsoft Access VBA Modules 1 25th Jan 2005 01:30 PM
Transaction Processing JimB Microsoft Access VBA Modules 1 24th Jun 2004 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 AM.