Subject: subform transaction
Posted By: elleetan Post Date: 9/18/2003 2:18:50 AM
i had try this out to undo subform transactions, but i still got many bugs:

i have 3 tables:, Terminalfault, TerminalFaultDetail, Componetused
i had created form by using the above 3 tables:
the mainform is call FrmFault:
   FaultDate:
   SerialNUmber:
  FaultNUmber:

*** subform call subform1  
     FaultNUmber:      
     Fault:   

***** subform call Component
      Component Number:
    Component Quantity

** for subform1 one faultNumber can have many fault , eg
  FaultNUmber = 111           Fault = 22
   faultnumber  = 111         Fault = 23        and so on

** similiar to the Component subform
  Component Number = 1111 Component Quantity = 2
 Component NUmber = 1111 component Quantity = 3

i tried to apply the code of subforms transactions from microosoft access 2000 but i don't really understand it

this is my undo module:
Option Compare Database
Option Explicit

Private mwks As DAO.Workspace
Private mfIntrans As Boolean
Const adhcSource As String = "subform1"

*** but unfortunately i didn't create the query , so can i admit this line "Const adhcSource As String = "subform1"


Private Sub resetdata()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim prm As DAO.Parameter
Dim strsource As String


If mfIntrans Then
mwks.CommitTrans
End If

Set mwks = DBEngine.CreateWorkspace("mwks", "Admin", "")
Set db = mwks.OpenDatabase(CurrentDb.Name)
Set qdf = db.QueryDefs(mstrsource)

For Each prm In qdf.Parameters
 prm.Value = Eval(prm.Name)
 Next prm
 Me.Painting = False
 Set rst = qdf.OpenRecordset
 rst.LockEdits = False
 Set Form_subform1.Form.recorset = rst
 Me.Painting = True
 
 mwks.BeginTrans
 mfIntrans = True
 
End Sub

** similiar to these code, i didn't create the query so it is not working, so do i modify it as i didn't create a query???

Me.undo
If mfIntrans Then
mwks.Rollback
mfIntrans = False
FaultDate.SetFocus
Call resetdata
End If


Could you please help me , thank you very much!!!


Go to topic 4249

Return to index page 1043
Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034