Databound forms

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

If I make a change to a data bound control, does ACCESS actually translate
the change into a SQL statement and run the statement using
Application.CurrentProject.Connection object?

I need to find ways to ensure that changes on the main form and subforms
happen within a single transaction context, without having to resort to
using unbound controls (which obviously defeat the purpose of using ACCESS
VBA in the first place).

I have been given the suggestion to start a transaction in the BeforeUpdate
event handler and commit the transaction in the AfterUpdate event handler
(ie., depending on whether main form or subform gets changed first, call
Application.CurrentProject.Connection.BeginTrans in Form_BeforeUpdate of
main form and Application.CurrentProject.Connection.CommitTrans in
Form_AfterUpdate of subform). My impression is that AfterUpdate actually
occurs when the change is already complete. However, if I wrap them in
BeginTrans and CommitTrans, does that change the default behaviour of
ACCESS?

When I change records in subform, I use DoCmd.GotoRecord as the method to
scroll through subform records. I am just wondering how I can make the
change to all the records on the subform happen within the same transaction,
without resorting to ADO (or even DoCmd.RunSQL statement).

Similarly, when I change a particular record on the subform (let me make it
a concrete example. Let's say that the subform displays order line details.
Every time order line qty is changed, I want to update inventory records).
The logical thing to do obviously is to update inventory record in the
BeforeUpdate event handler of the qty bound control. However, do the changes
I make within the BeforeUpdate event and change made directly to the Qty
bound control occur within 1 single transaction? Or are they really separate
transactions, in which case, inconsistency may occur?

Thanks in advance
 
Somewhat answered elsewhere.

Calvin, please be careful posting the same (or a very similar question)
under a new thread. If someone takes the time to answer the question in the
first thread, then they see the second thread, and someone else has already
answered there, this will not encourage them to answer again!

This is not the case here, but ... :-)

TC
 
Back
Top