Re: label control won't update

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Chris wrote:
>I have a main form with a tab strip control containing 3 tabbed pages.
>Each tabbed page contains a subform. Each tabbed page contains label controls.
>
>In the footer section of each subform are text box controls with sum
>functions used to sum the values in particular rows of the data sheet.
>
>In the change event of the tabcontrol which is on the main form I have code
>like this:
>
>With Me.SubFormChild1.Form.RecordsetClone
> If .RecordCount > 0 Then
> Me.lblamount.Caption =
>Format(Me.SubFormChild1.Form.txtamounttotal.Value, "#,##.00")
> End If
>End With
>
>the recordsetclone is used to determine if there are records because if
>there are
>none and I try to put the totaled value into the caption property it will
>error.
>
>This works fine when I step through the code in debug mode.
>If I turn off the break point and let it run without stopping the labels do
>not
>get populated they are empty and my default value of 0 (zero) is wiped out.
>
>Now when I exist the debugged code I have to goto the window drop down in
>Access and choose my main form again to get it to be seen. This likely fires
>some sort of event that refreshes the form or something and lets the values
>display.


Try using the Repaint method at the end of your procedure.

If that's insufficient, then try adding a DoEvents statement
before you retrieve the value from the sum control.

If neither or both of those don't work, then the timing
issue (code runs before the Sum is calculated) is too severe
and you won't be able to use code to get this effect. Try
changing the label to a text box that refers to the Sum text
box.

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: Is this a Sound Database Design? -- code: SwitchTabs
    ... The "command buttons" (put in quotes because I actually used label ... Dummy is an unbound control -- really tiny because I use labels instead ... Sometimes, the subforms do not have linking fields, like a lookup subform ... Dim mCurrentTab As Integer, i As Integer, mBoo As Boolean ...
    (microsoft.public.access.tablesdbdesign)
  • RE: Totals Row Not Summing
    ... to SUM, but it doesn't calculate a sum. ... Let's say your subform text box control is txtCost and it's ControlSource is ... I enabled the totals row on the two datasheet subforms, ...
    (microsoft.public.access.forms)
  • Re: Total from a subform
    ... Thank you that was the problem once I added the sum function to the formula ... Never base a calculation on a calculation, ... Create the calculated field in the form footer of the subform like ... Ensure to name the control a name you will remember such as ...
    (microsoft.public.access.forms)
  • Re: label control wont update
    ... Did you try removing the Change event code and changing the ... If you can live with it, moving that text box to the subform ... Each tabbed page contains label controls. ... >>>functions used to sum the values in particular rows of the data sheet. ...
    (microsoft.public.access.formscoding)
  • Re: Is this a Sound Database Design? -- code: SwitchTabs
    ... The "command buttons" (put in quotes because I actually used label controls) to switch subforms are colored so that you can see which one is active ... TabID is an unbound control -- it is set when the form loads ... Sometimes, the subforms do not have linking fields, like a lookup subform ... Dim mCurrentTab As Integer, i As Integer, mBoo As Boolean ...
    (microsoft.public.access.tablesdbdesign)