Getting Control.Value From Subform: Only Works In Break Mode?

P

PeteCresswell

Got a parent form and a subform.

In the parent's VBA, I'm trying to extract a value from a computed
total field (.ControlSource=Sum(Whatever)) so I can display it to
the user in color up on another subform (at the user's request...)

It's as if that subtotal had zero for a value unless I break the code
anywhere before I capture then value.

Once it resumes from the break, the value's there.

Here's a code snip. More upon request.
-------------------------------------------------------------------
2550 With Me.subSecurity.Form
2551 If Me.subTrades.Enabled = True Then 'Ensures that
subform is present and has a .RecordSet
2552 Me.subTrades.Form!txtParTotal.Requery
2553 curParTotal = Me.subTrades.Form!txtParTotal.Value
'MsgBox curParTotal
2554 !txtParTotal.Value = curParTotal
2555 !txtParTotal.Requery
2556 End If
2559 End With
-------------------------------------------------------------------

Put a break in the code at line 2552 and it works a-ok. The now-
commented-out MsgBox is
just a leftover from my trying to nail something down.

No break - or a break at line 2553, and it's as if subTrades.Form!
txtParTotal.Value=0.


Anybody been here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top