Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2012

    Unanswered: form / subform problem

    Hi all

    I have a form with several subforms on it. I have a text box that has a yes/no field. I use this to lock the form/subform by code on each current form event.
    If Forms!frmShiftMain.txtLocked = -1 Then
    Me.AllowEdits = False
    Me.AllowAdditions = False
    Me.AllowEdits = True
    Me.AllowAdditions = True
    End If

    Exit Sub


    In the footer I have a text box that sums a field in the detail part of the form.

    Then on the main form I have a text box that sums all the data from all of the subforms. every thing works well until one of the subforms has no data and there is no records there. then the txtbox in the footer of the subform has nothing to sum therefore the textbox on the main form shows a error.

    not sure where to go have tried to change the control source of the textbox by code but did not work tried the Nz function that did not work.

    So looking for new idea's

    Cheers bob

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 35
    Its not a NULL , its an error, no records to sum. So you could keep it hidden until it has records.. txtSum.visible = txtsum > 0

  3. #3
    Join Date
    Oct 2012

    Problem clarification

    I have One main form with 5 different subforms each subform footer has a text box that an expression to sum a field in the subform. The main form has a textbox that sums all of the totals from each subform When I post the entry I change a hidden textbox value to -1 on the (on current event)it checks to see the value on the hidden text box and if it is -1 then it sets the forms allowedits and allowaddition to false thus stopping edits or additions. If there are no records in any single form I get the error on the main form.

    Hope this helps in clarification

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    or even
    on error resume next
    avalue = avalue + forms!asubform.control.value
    avalue = avalue + forms!anothersubform.control.value

    ...or use the NZ function

    or post the values to the main form
    forms!myparnetform.control.value = forms!myparnetform.control.value + thisform.thiscontrol.value
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts