G
gmenon100 via AccessMonster.com
Dear Friends,
I have a problem with staying on the last edited record. I will summarize my
project as under.
I have a main form "Shipment" which has 10 fields, 3 editable and the rest 7
derive totals from the undelying 3 subforms. This main form has a subform
"Entry Reg" which has 7 fields 3 editable and the rest deriving totals from
the underlying 2 subforms. Entry Reg has a subform "Invoice" which has 12
editable fields and 3 deriving totals from the underlying last subform
"Product".
In short the user first starts with creating a shipment and enters
information, he then enters data on Entry Reg. There can be multiple entries
for each shipment. Each entry can have one invoice or multiple invoices and
each invoice can similarlly have one or multiple products. After update,
products form, it runs a code to update all totals on the invoice subform,
Entry Ref subform and finally the Shipment main form. But as a result of the
code, it takes me back to the first record on the entry form with the code I
am using. I am sure I am missing some thing. I cannot do without putting the
totals on the forms as they are used in other reports. My code is as under
where OrdDetID is the product ID.
Private Sub Form_AfterUpdate()
With Me.RecordsetClone
Dim lngorddetId As Long
lngorddetId = Me.OrdDetID
Me.Requery
Me.Parent.Parent.Parent!ShpTotPcs = Me.ShiptotQrysub!shppcs
Me.Parent.Parent.Parent!ShpDuty = Me.ShiptotQrysub!shpdty
Me.Parent.Parent.Parent!ShpAch = Me.ShiptotQrysub!ShpAch
Me.Parent.Parent.Parent!ShpInvVal = Me.ShiptotQrysub!InvoiceValue
Me.Parent.Parent.Parent!ShpTotDty = Me.Parent.Parent.Parent!ShpDuty + Me.
Parent.Parent.Parent!ShpAch
Me.Parent.Parent!EntPcs = Me.EntrytotQrysub!EntPcs
Me.Parent.Parent!EntDuty = Me.EntrytotQrysub!entdty
Me.Parent.Parent!EntInv = Me.EntrytotQrysub!InvoiceValue
Me.Parent.Parent!EntTotDuty = Me.Parent.Parent!EntDuty + Me.Parent.Parent!
EntAch
Me.Parent.Parent!EntLoc = Me.Parent.Parent.Parent!ShpTotLoc
Me.Parent.Parent!EntInt = Me.Parent.Parent.Parent!ShpTotInt
Me.Parent.Parent.Refresh
Me.Parent!INVVAL = Me.InvtotQrysub!InvoiceValue
Me.Parent!POVal = Me.InvtotQrysub!POVal
Me.Parent!Totpcs = Me.InvtotQrysub!Invpcs
Me.Parent!TotDty = Me.InvtotQrysub!Invdty
Me.Parent!Freight = Me.InvtotQrysub!Frtppd
Me.Parent!TotAch = Me.EntrytotQrysub!AchAmt
Me.Parent.Refresh
.Find "orddetid=" & lngorddetId
If Not .EOF Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
Any help, comments or advise is appreciated.
Thank you,
G Menon
I have a problem with staying on the last edited record. I will summarize my
project as under.
I have a main form "Shipment" which has 10 fields, 3 editable and the rest 7
derive totals from the undelying 3 subforms. This main form has a subform
"Entry Reg" which has 7 fields 3 editable and the rest deriving totals from
the underlying 2 subforms. Entry Reg has a subform "Invoice" which has 12
editable fields and 3 deriving totals from the underlying last subform
"Product".
In short the user first starts with creating a shipment and enters
information, he then enters data on Entry Reg. There can be multiple entries
for each shipment. Each entry can have one invoice or multiple invoices and
each invoice can similarlly have one or multiple products. After update,
products form, it runs a code to update all totals on the invoice subform,
Entry Ref subform and finally the Shipment main form. But as a result of the
code, it takes me back to the first record on the entry form with the code I
am using. I am sure I am missing some thing. I cannot do without putting the
totals on the forms as they are used in other reports. My code is as under
where OrdDetID is the product ID.
Private Sub Form_AfterUpdate()
With Me.RecordsetClone
Dim lngorddetId As Long
lngorddetId = Me.OrdDetID
Me.Requery
Me.Parent.Parent.Parent!ShpTotPcs = Me.ShiptotQrysub!shppcs
Me.Parent.Parent.Parent!ShpDuty = Me.ShiptotQrysub!shpdty
Me.Parent.Parent.Parent!ShpAch = Me.ShiptotQrysub!ShpAch
Me.Parent.Parent.Parent!ShpInvVal = Me.ShiptotQrysub!InvoiceValue
Me.Parent.Parent.Parent!ShpTotDty = Me.Parent.Parent.Parent!ShpDuty + Me.
Parent.Parent.Parent!ShpAch
Me.Parent.Parent!EntPcs = Me.EntrytotQrysub!EntPcs
Me.Parent.Parent!EntDuty = Me.EntrytotQrysub!entdty
Me.Parent.Parent!EntInv = Me.EntrytotQrysub!InvoiceValue
Me.Parent.Parent!EntTotDuty = Me.Parent.Parent!EntDuty + Me.Parent.Parent!
EntAch
Me.Parent.Parent!EntLoc = Me.Parent.Parent.Parent!ShpTotLoc
Me.Parent.Parent!EntInt = Me.Parent.Parent.Parent!ShpTotInt
Me.Parent.Parent.Refresh
Me.Parent!INVVAL = Me.InvtotQrysub!InvoiceValue
Me.Parent!POVal = Me.InvtotQrysub!POVal
Me.Parent!Totpcs = Me.InvtotQrysub!Invpcs
Me.Parent!TotDty = Me.InvtotQrysub!Invdty
Me.Parent!Freight = Me.InvtotQrysub!Frtppd
Me.Parent!TotAch = Me.EntrytotQrysub!AchAmt
Me.Parent.Refresh
.Find "orddetid=" & lngorddetId
If Not .EOF Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
Any help, comments or advise is appreciated.
Thank you,
G Menon