• Referencing subforms (97)

    Author
    Topic
    #368149

    I have 2 subforms on a master form. I want to have a grand total in one of the subforms which is a sum of a figure from each of the subforms. The expression: Var1 = Me.Parent!SubFrm1!MayTotal.Value when entered in Subform2 results in Var1 = 0 (where Var1 is a public variable) UNLESS I step through the procedure. In that case, the value of MayTotal is stored to Var1.

    H E L P
    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #576140

      This is probably a timing problem, as subform2 is trying to get the information from subform1 before subform1 has had a chance to fill the textbox. When you step thru the code, subform1 has had a chance to finish.

      I’m not particularly sure how you can resolve this, other than to somehow delay subform2 to allow subform1 to catch up.

    • #576143

      Put this code in your utility functions and then pause your subform code at the appropriate point for as long as you think necessary.

      Sub Pause(ByVal nSecond As Single)
      Dim t0 As Single
      t0 = Timer

      Do While Timer – t0 < nSecond
      Dim dummy As Integer
      dummy = DoEvents()
      ' if we cross midnight, back up one day
      If Timer < t0 Then
      t0 = t0 – 24 * 60 * 60
      End If
      Loop

      End Sub
      Peter Herworth

    Viewing 1 reply thread
    Reply To: Referencing subforms (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: