Can I Force A Save of Sub1 from Sub2? (1 Viewer)

micks55

Registered User.
Local time
Today, 17:19
Joined
Mar 20, 2006
Messages
110
While putting prices into Sub2, Sub1 gets updated with the total but the Sub1 footer total doesn't update. Can I remotely force a save of Sub1 so that the footer totals get updated as well?

Me.Parent!Sub1.Requery works but leaves the focus with the first record in Sub1.
Me.Parent!Sub1!OpsTotal.Recalc gives me "Object doesn't support this property or method"
Me.Parent!Sub1!OpsTotal.Requery seems to do nothing.

My structure is…
One Order has many OrderDetails
One OrderDetails has one Product but…
Because the specs for different products are so diverse (from 2 to 35 fields), I have 15 product tables.

Sub2 is sized to take any one of the 15 product forms and it's SourceObject is changed in the OnCurrent event of Sub1 depending on the product selected.

Is this a dumb way of doing things? Should I dump the Product tables and put 35 extra fields in the OrderDetails table?

Thanks in advance for any comments at all.
Mike (A2k)
 

DCrake

Remembered
Local time
Today, 17:19
Joined
Jun 8, 2005
Messages
8,626
I think Access is getting confused because you are using names such as Sub1 and Sub2. Try changing the names to something less ambigious that could not be construed as being a reserved word.
 

micks55

Registered User.
Local time
Today, 17:19
Joined
Mar 20, 2006
Messages
110
Thanks for the response. I was using aliases to try and make it clearer.
Main is frmEnquiries, Sub1 is frmEnqDets and Sub2 is a control on the main form called subFrame.
While in subFrame (Sub2) I change one of the prices and would like the other sub to update fully including its footer total.
Thanks again, Mike
 

DCrake

Remembered
Local time
Today, 17:19
Joined
Jun 8, 2005
Messages
8,626
By saying what you have now explained makes it more complicated to understand that you are using different coltrol types. If you explain it correctly in the first place then this would cut down on the cross dialog.

So are you using main form / subform methodolgy? Still can't quite grasp your requirment.
 

micks55

Registered User.
Local time
Today, 17:19
Joined
Mar 20, 2006
Messages
110
So very sorry for confusions.

The main form shows one enquiry and the usual sub shows the many enquiry details records. Each of the details records is linked to one record in one of the different product tables (products specifications are very varied).

The OnCurrent event of the EnquiryDetails (first sub) selects the appropriate product form and displays it in the second sub called subFrame.

In the product form now loaded as the SourceObject of subFrame (second sub) there are some price boxes. The total of these prces is stored in the EnquiryDetails section so that an overall picture of the enquiry is seen as seperate lines in the Details sub where there is an overall total in the footer.

I am able to put the correct prices total into the Details section but as it hasn't been saved, the footer will not undate untill I go to the Details sub and move to a different record.

Hope that's a bit clearer.
Mike
 

DCrake

Remembered
Local time
Today, 17:19
Joined
Jun 8, 2005
Messages
8,626
Which is correct, what you need to do is to force a save when the value changes.
 

micks55

Registered User.
Local time
Today, 17:19
Joined
Mar 20, 2006
Messages
110
Could you possibly point me towards finding how to do that.
Thanks again,
Mike
 

micks55

Registered User.
Local time
Today, 17:19
Joined
Mar 20, 2006
Messages
110
Thanks to Allen Browne who said...
You could dirty the record by assigning the existing (default) value to a
control, and then saving:

With Me.X.Form
!Field1 = !Field1
.Dirty = False
End With

Adapted it to
With Me.Parent!frmEnqDets.Form (my form ! my sub1)
!OpsEach = !OpsEach (a control on my sub1)
.Dirty = False
End With

Seems to work ok without any requery or refinding the record.

Thanks to DCrake for making me look in a different direction.
Mike
 
Last edited:

Users who are viewing this thread

Top Bottom