The issue is that the calculated text box does not actually requery until each of the associated listboxes have been clicked into and exited.
I have an unbound form that looks up various pieces of a product number entered in an unbound text box (ProductNumber) and returns weights and lengths in unbound listboxes that are based on queries.
The criteria for the queries are based on functions that return a specific string from the product number.
Then there is a calculated textbox control (txtCombinedLen mm AND txtCombinedWeig hts) based on the list box controls (which is also the listbox's underlying query's value). The calculation only uses the control if there is a result in that listbox control.
On the On_Exit of the product number control:
all associated controls are being requeried, the calculated textbox's control source is determined and then the calculated control is requeried:
Then
Is there a way to have the text box recalculate the entire formula with all involved controls without having to get focus and exit each of the controls in the calculation? Neither RECALC, REFRESH, nor REQUERY for the form or controls is working.
Thank you in advance for any help - nothing logical seems to be working.
with ruth
I have an unbound form that looks up various pieces of a product number entered in an unbound text box (ProductNumber) and returns weights and lengths in unbound listboxes that are based on queries.
The criteria for the queries are based on functions that return a specific string from the product number.
Then there is a calculated textbox control (txtCombinedLen mm AND txtCombinedWeig hts) based on the list box controls (which is also the listbox's underlying query's value). The calculation only uses the control if there is a result in that listbox control.
On the On_Exit of the product number control:
all associated controls are being requeried, the calculated textbox's control source is determined and then the calculated control is requeried:
Code:
Me.txtCombinedLenmm.ControlSource = "=IIf(nz([lstRingSizeGroundmm],0)=0 And nz([lstRingSizemm],0)=0,Round(CDbl(nz([lstSusLenmm],0))+CDbl(nz([lstLPlenmm],0))+146.05,2),CDbl(Round(nz([lstSusLenmm],0)+nz([lstLPlenmm],0)+nz([lstRingSizemm],0)+nz([lstRingSizeGroundmm],0)+146.05,2)))" Me.txtCombinedWeights.ControlSource = "=Round(nz([lstSusWgtKg],0)+nz([lstLPwgtKg],0)+nz([txtKgRingWgtGrnd],0)+nz([txtKgRingWgt],0),2)"
Code:
Me.txtCombinedLenmm.Requery
Me.txtCombinedWeights.Requery
Thank you in advance for any help - nothing logical seems to be working.
with ruth
Comment