Solved

Transactions on DBGRID

Posted on 1998-09-27
3
238 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 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