?
Solved

Grid Development

Posted on 2003-03-12
6
Medium Priority
?
168 Views
Last Modified: 2010-05-01
Hi all

Ok heres my query...

I have a grid which i use to display data extracted from a database.
I want this grid to be editable, but want that the changes are made in the database only when i press the command button "Save"

However, currently I am facing the problem, that even if i Press Cancel, any changes made in the grid are saved to the database. Can I prevent this dynamic save in any way????

Pls help.


THx
Megha
0
Comment
Question by:megha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:megha
ID: 8124670
my current code is this:

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub Form_Load()

Call Open_rneVersionCtrl

Set dbgProdVersCtrl.DataSource = frmLogin.rneVersionCtrl

dbgProdVersCtrl.Columns(0).Locked = True
dbgProdVersCtrl.Columns(1).Locked = True

End Sub

Public Sub Open_rneVersionCtrl()

'close record set if it is open
If frmLogin.rneVersionCtrl.State = adStateOpen Then frmLogin.rneVersionCtrl.Close

frmLogin.rneVersionCtrl.CursorLocation = adUseClient 'set the CursorLoccation for rneUser

frmLogin.rneVersionCtrl.Open "SELECT Proj_Prod_Relation.product, Version_Control.* FROM Proj_Prod_Relation, Version_Control WHERE Version_Control.projPRodID = Proj_Prod_Relation.projProdID AND Proj_Prod_Relation.customerID = '" & custIDSelected & "' AND Proj_Prod_Relation.projectID = '" & projectIDSelected & "'", frmLogin.cneSupport, adOpenStatic, adLockOptimistic

End Sub

Hope this helps....
0
 
LVL 11

Expert Comment

by:supunr
ID: 8124708
why not use trasactions.

e.g.

Private Commit as boolean
Private conn as ADODB.Connection

Private Sub Form_Load()
   Commit = false
   ' Open the connection
   Set conn = new ADODB.Connection
   conn.Open "<your connection string>"
   ' begin trasaction
   conn.BeginTrans
End Sub

Private cmdOK_Click()
    Commit = true
    Unload Me
ENd Sub

Private cmdCancel_Click()
    Unload Me
ENd Sub

Private Sub Form_Unload()
    If (conn.State = adStateOpen) then
        if (Commit) then
            conn.CommitTrans  ' save changes
        else
            conn.RollbackTrans 'undo changes
        End if
        conn.close
        set conn = nothing
    end if
End Sub
0
 

Author Comment

by:megha
ID: 8124725
Hi thx
will try and get back to u on the result
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Expert Comment

by:inthedark
ID: 8125931
The other way is to use a disconnected record set.  Or disconnected the recordset after you read but before you display the data.
0
 

Author Comment

by:megha
ID: 8258998
hi i tried using cancel update and that worked..

but thx for yur help.. transactions was giving me some problem

0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 8284796
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

762 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