Solved

Transactions on DBGRID

Posted on 1998-09-27
3
236 Views
Last Modified: 2013-12-25
How I do transactions methods BeginTrans, Rollback and Commit in DBGRID32 Bound a datacontrol.
0
Comment
Question by:eduguai
3 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1487173
You cannot.

There is a problem inherant with all grids that prevent transaction processing.
I have solved this problem in the past by creating a dummy table and moving the data there (which DBGrid reads) then, when done, I move the data back.
0
 

Author Comment

by:eduguai
ID: 1487174
I can create workspace variable and work transactions in events  gotfocus and lostfocus,  because the dbgrid first edit and update records
by example
in gotfocus event:
   vworkspace.begintrans

in lostfocus event:
if msgbox(save data ?) = vbyes
   vworkspace.commit
else
   vworkspace.rollback
endif

and procedure in dbgrid unbound for transaccions in
unboundreaddata, unboundwritedata, ...?
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1487175
I'm sorry for the late answer. Somebody answered it and I missed the question.

Ofcourse you can do it. Here is a sample,
On form_load the transaction is started. Depending on OK/Cancel the changes are commited or revoked.

Private Sub CommandCancel_Click()
    Workspaces(0).Rollback
    Unload Me
End Sub

Private Sub CommandOK_Click()
    Workspaces(0).CommitTrans
    Unload Me
End Sub

Private Sub Form_Load()
    Workspaces(0).BeginTrans
End Sub

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now